Hello. Please, help me š¢
When I click upload, a request is sent to http//:192.168.100.104/uploads instead of http//:192.168.100.104:8000/uploads
Console error:
PATCH http://192.168.100.104/uploads/fc5b6926e402362897fb241c9e42dff0 net::ERR_CONNECTION_REFUSED
Nginx runs on port 8000 proxying data for the express js server.
And tus server is integrated into express.
Tus client:
new Uppy().use(Tus, {
endpoint: "http://192.168.100.104:8000/uploads",
chunkSize: 1024 * 1024 * 200, // 200 MB
})
Nginx Config:
server {
listen 8000;
server_name _;
location / {
proxy_pass http://192.168.100.104:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_buffering off;
}
}
express js:
const uploadFilesRouter = Router();
const server = new Server({
respectForwardedHeaders: true,
path: "/uploads",
datastore: new FileStore({ directory: "files" }),
});
router.all("*", (req, res, next) => {
console.log(req.method, req.url);
server.handle(req, res);
});
In the main file I import like this:
app = express();
app.use("/uploads", fileUploadRouter );