Welcome! Log In Create A New Profile

Advanced

Websocket handshake failing

July 30, 2015 11:19AM
I'm trying to enable websocket communication between client and server and have nginx as proxy. Ive applied the following congiguration changes to websocket sites-enabled conf to allow for websocket proxy:
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://mywebsite;

Although the server receives the Connection: Upgrade header and responds with aConnection: Upgrade header as expected, the client gets only Connection: keep-alive and I see the following error on js-console

WebSocket connection to 'wss://mywebsite.dev/cometd/' failed: Error during WebSocket handshake: 'Connection' header value must contain 'Upgrade'

I feel that nginx might not be proxying the response correctly either due to incorrect response or bad config.

Can someone help me out with debugging this? A lot of places where I see this issue, usually the proxy does not support the websocket handshake which causes the handshake to fail.

Appreciate the help!
Subject Author Posted

Websocket handshake failing

nightcrawler July 30, 2015 11:19AM

Re: Websocket handshake failing

Maxim Dounin July 30, 2015 01:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 55
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready