I have a @tus/server backend with a react uppy frontend. And when uploading I’m getting this response
“The file for this url was not found”
Im runnin multiple containers and the vps is behind nginx.
In the frontend I’m using uppy like this
const [uppy] = useState(() => new Uppy().use(Tus, { endpoint: 'https://app.chatzu.ai/files/' }));
the frontend does these requests in order
Request URL:
https://app.chatzu.ai/files
Request Method:
POST
Status Code:
301 Moved Permanently
Remote Address:
<IP>
Referrer Policy:
strict-origin-when-cross-origin
Request URL:
https://app.chatzu.ai/files/
Request Method:
GET
Status Code:
404 Not Found
Remote Address:
<IP>
Referrer Policy:
strict-origin-when-cross-origin
Nginx conf
location /files/ {
proxy_pass http://172.17.0.4:1080;
# Disable request and response buffering
proxy_request_buffering off;
proxy_buffering off;
proxy_http_version 1.1;
# Add X-Forwarded-* headers
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
client_max_body_size 0;
}
and my tus server code
const { Server } = require('@tus/server');
const { FileStore } = require('@tus/file-store');
const express = require('express');
const host = '0.0.0.0';
const port = 1080;
const app = express();
const uploadApp = express();
const server = new Server({
path: '/files',
datastore: new FileStore({ directory: '/files' }),
});
// Middleware to log all incoming requests
uploadApp.use((req, res, next) => {
console.log(`[${new Date().toISOString()}] ${req.method} ${req.originalUrl}`);
next(); // Pass control to the next middleware or route handler
});
uploadApp.all('*', server.handle.bind(server));
app.use('/files', uploadApp);
app.listen(port, host, () => {
console.log(`Server listening on http://${host}:${port}`);
});
Thanks