Websocket (wss) connection issue (status 200 instead 101) between two nginx systems

Francis Daly francis at daoine.org
Sun Apr 19 18:55:40 UTC 2020

On Sat, Apr 18, 2020 at 05:39:38PM -0400, YAGA wrote:

Hi there,

> From local network, the nginx web site of the “black box” is working
> properly including websocket connection.

> From Internet, the “server”, the nginx reverse proxy gives me an access to
> the nginx web site of the “black box” everything works except the websocket,
> from my web browser I receive a status 200 but I should get 101 switching
> protocol.

Your config for the "black box" does not show the normal proxy_*
directives that are used for websockets.

Your config for the "server" does.


Does anything change if you add those directives to the "black box" system?

> “black box” web server nginx config (extract)

>         location /websocket {
>             proxy_pass;
>         }

> “server” reverse proxy nginx config (extract)

>                 location /websocket {
>                         proxy_set_header Upgrade $http_upgrade;
>                         proxy_set_header Connection upgrade;
>                         proxy_http_version 1.1;
>                         proxy_set_header Origin "";
>                         proxy_pass;
>                         auth_basic off;
>                 }

I don't actually know if a websocket connection will pass cleanly through
two reverse proxies. I guess this is as good a time as any to learn if
it can!

Good luck with it,

Francis Daly        francis at daoine.org

More information about the nginx mailing list