0

In my app client connect to backend over nginx with WebSockets connection.

My nginx has next config:

        server {
                listen 80;
                listen 443 ssl;

                ssl_certificate         ...
                ssl_certificate_key     ...

                server_name ...

                proxy_socket_keepalive on;
                keepalive_timeout 10;

                location /ws {
                    proxy_pass http://localhost:10001;

                    proxy_http_version 1.1;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection "upgrade";
                }
        }

Problem is, when client disconnect form Nginx backend WebSocket connection still in Open state.

How to configure Nginx to drop upstream connection when client connection disconnected?

Sergey Shulik
  • 950
  • 1
  • 9
  • 24
  • For how long connection hangs up after client was disconnected? And what is in `error.log`? And you sure about `proxy_socket_keepalive on;` and `keepalive_timeout 10;`? –  Apr 11 '22 at 19:30

0 Answers0