I can't get over the nginx 60s timeout. If I access the node server directly at 8000 it works, through nginx as reverse proxy it always times out after 60s. I have tried every timeout setting I have read on my google journey regarding this problem...
Anyone can help me out here?
Cheers
Minimal steps to reproduce:
server {
listen 80;
server_name someserver.net;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_connect_timeout 75s;
proxy_send_timeout 900s;
proxy_read_timeout 900s;
send_timeout 900s;
client_body_timeout 900s;
keepalive_timeout 900s;
}
}
The minimal node.js server:
const http = require('http');
const server = http.createServer((req, res) => {
const match = req.url.match(/timeout=(\d+)/);
const timeout = (match ? parseInt(match[1]) || 60 : 60) * 1000;
setTimeout(() => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Response');
res.end();
}, timeout);
}).listen(8000, "0.0.0.0");
server.timeout = 15 * 60 * 1000;
# direct connection: works
curl -v "http://someserver.net:8000?timeout=65"
# timeout of 59s via proxy: works
curl -v "http://someserver.net?timeout=59"
# timeout > 60s via proxy: times out
curl -v "http://someserver.net?timeout=61"