I have Node.js using Nginx setup and it includes events with the server.
No matter what my Nginx configuration is, the sse connection is disconnected after 60 seconds and reinitialized. This does not happen if I connect to the application directly on the port on which node is serving it, so there is obviously a problem with the Nginx proxy.
I would not want a timeout when connecting sse. Is it possible? I tried the settings send_timeout, keepalive_timeout, client_body_timeoutand client_header_timeout, but it does not 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;
}
}
source
share