NGINX and websocket endpoint

Gurumurthy Sundar Gurumurthy.Sundar at telventdtn.com
Tue Mar 17 17:42:04 UTC 2015


I am trying to configure nginx as reverse proxy that does authentication and websockets. It proxy-passes request
to apache (/auth/wsgi) for authentication - once that succeeds, it then proxy passes to the websocked backend,
which is a java based websocket endpoint on tomcat 8.


location /basic/alerting/websocket {

            auth_request /auth/wsgi;


            proxy_pass http://backend.com:8080/websocket;
            proxy_http_version 1.1;
                    proxy_set_header Upgrade "Websocket";
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $http_host;

        }

The authentication on apache succeeds. However, on the backend tomcat, I get this error:


12572237 [http-nio-8080-exec-10] ERROR org.springframework.web.socket.server.support.DefaultHandshakeHandler  - handleWebSocketVersionNotSupported() Handshake failed due to unsupported WebSocket version: null. Supported versions: [13]

It seems that failure is because the backend is expecting the header ("Sec-WebSocket-Version") which is not getting passed through. I even see in the nginx logs:

2015/03/17 17:28:12 [debug] 20261#0: *718 http proxy header: "Sec-WebSocket-Version: 13"

Is there anything I need to do in the nginx config? Very much appreciate your help.


NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150317/67383586/attachment-0001.html>


More information about the nginx mailing list