I have a Node.js via Nginx setup and it involves Server-Sent Events.
No matter what Nginx configuration I have, connection of sse is broken after 60 seconds and reinitialized again. It doesn't happen if I connect to application directly on port on which node serves it, so it's clearly some Nginx proxy issue.
I'd like to have no timeout on sse connection. Is that possible? I've tried tweaking send_timeout
, keepalive_timeout
, client_body_timeout
and client_header_timeout
but it doesn't change anything. Below is my Nginx configuration.
upstream foobar.org {
server 127.0.0.1:3201;
}
server {
listen 0.0.0.0:80;
server_name example.org;
client_max_body_size 0;
send_timeout 600s;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://example.org/;
proxy_redirect off;
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
}
}