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!
Posted at Nginx Forum: