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.

http://nginx.org/en/docs/http/websocket.html

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

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

>         location /websocket {
>             proxy_pass      https://127.0.0.1:80;
>         }

> “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 https://192.168.1.20:80/;
>                         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,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list