M
M
Mikhail Markov2019-06-25 21:15:19
Python
Mikhail Markov, 2019-06-25 21:15:19

Why doesn't nginx let me close the websocket?

Friends, colleagues, comrades! - I am writing shit code in python that uses WSS, the application itself uses gevent. Before all this, there is an nginx proxy with the following configuration:

server {
        listen 80;
        listen 443;
        ssl on;
        ssl_certificate /etc/letsencrypt/live/bookforker.tk/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/bookforker.tk/privkey.pem; # managed by Certbot

        server_name name.tk www.name.tk;

        access_log  /var/log/nginx/access.log;
        error_log  /var/log/nginx/error.log;

        location / {
                proxy_pass                      https://localhost:5000;
                proxy_redirect                  off;
                proxy_set_header                Host                    $host;
                proxy_set_header                X-Real-IP               $remote_addr;
                proxy_set_header                X-Forwarded-For         $proxy_add_x_forwarded_for;
                proxy_set_header                X-Forwarded-Proto       $scheme;

                # WebSocket support
                proxy_set_header                Upgrade                 $http_upgrade;
                proxy_set_header                Connection              "upgrade";
                proxy_http_version              1.1;
        }
}

Tried different ones, none work properly.
And the problem is that the sockets simply do not close, alas and ah. What could be the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2019-06-25
@SagePtr

I believe that if you simply pass the "upgrade" constant, then this will be transmitted for all connections, even if there was a connection: close that should have been there originally.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question