Score:0

nginx returns 499 with 110: Connection timed out in error log

ua flag

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"
Score:-2
ua flag

If anyone ever stumbles over this: it turns out you need to increase

client_header_timeout

and/or

client_body_timeout

Everything else failed to make it work in my case.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.