Websocket proxy

Alder Network aldernetwork at gmail.com
Wed May 8 22:35:58 UTC 2013

This must have been discussed before but I am new to nginx
and this forum.

I am upgrading to 1.4 to use its websocket proxy feature.
Say I have a websocket server running at port 81, so I want
to forward all websocket packets to port 81, and process
the rest at port 80.

Somehow the following conf doesn't work, anything missing?

   server {
        listen        [::]:80 ipv6only=off;

        location / {

            if ($http_upgrade = "websocket") {
                proxy_pass http://localhost:81;

            proxy_http_version 1.1;
            proxy_set_header Upgrade websocket;
            proxy_set_header Connection upgrade;

- Alder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130508/f4c54c33/attachment.html>

More information about the nginx mailing list