WebSockets vs Nginx

If you are using a nginx as a reverse proxy for a websocket and you want to support upgrading ws to wss, you are in trouble. Nginx will consume and upgrade value from the Connection header, as well as the value Upgrade: websocket. You will need to manually pass these values through, e.g.

    location / {
        proxy_pass http://127.0.0.1:8001;
        proxy_set_header Connection $http_connection;
        proxy_set_header Upgrade $http_upgrade;
        proxy_pass_request_headers on; # this is the same as default values
    }

Some links discussing this: