Issue in configuring nginx for libwebsocket

Hemant Kumar mailtohemantkumar at gmail.com
Sat Oct 19 02:32:35 UTC 2013


I changed the configuration to :

  location /hello {
            hello;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
            proxy_pass http://localhost:80;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $host;
        }



With a helllo module compiled in and when I send the GET request with
upgrade connection for protocol swicth,
although I do not get 502 error for BAD_GATEWAY but I end up having normal
200k instead of
protocol switch 101 response.

Please suggest, where I am going wrong.

Thanks
Hemant



On Fri, Oct 18, 2013 at 7:09 PM, Hemant Kumar
<mailtohemantkumar at gmail.com>wrote:

> Hi All
>
> I am a newbie with nginx server. I am trying to get websocket
> configuration working on cent-os.(linux 2.6.32-358.18.1.el6.x86_64).
> Following is my nginx config file;
>
> http {
>     include       mime.types;
>     default_type  application/octet-stream;
>
>     #log_format  main  '$remote_addr - $remote_user [$time_local]
> "$request" '
>     #                  '$status $body_bytes_sent "$http_referer" '
>     #                  '"$http_user_agent" "$http_x_forwarded_for"';
>
>     #access_log  logs/access.log  main;
>
>     sendfile        on;
>     #tcp_nopush     on;
>
>     #keepalive_timeout  0;
>     keepalive_timeout  65;
>
>     #gzip  on;
>
>     server {
>         listen       80;
>         server_name  localhost;
>
>         #charset koi8-r;
>
>         #access_log  logs/host.access.log  main;
>
>         location / {
>             root   html;
>             index  index.html index.htm;
>            * proxy_pass http://localhost:80*;
>             proxy_http_version 1.1;
>             *proxy_set_header Upgrade $http_upgrade;*
> *            proxy_set_header Connection "upgrade";*
> *            proxy_set_header Host $host;*
>             proxy_read_timeout 3600;
>             proxy_send_timeout 3600;
>         }
>
>         #error_page  404              /404.html;
>          location / {
>     #        root   html;
>     #        index  index.html index.htm;
>     #    }
>     #}
>
>
>     # HTTPS server
>     #
>     #server {
>     #    listen       443;
>     #    server_name  localhost;
>
>     #    ssl                  on;
>     #    ssl_certificate      cert.pem;
>     #    ssl_certificate_key  cert.key;
>
>     #    ssl_session_timeout  5m;
>
>     #    ssl_protocols  SSLv2 SSLv3 TLSv1;
>     #    ssl_ciphers  HIGH:!aNULL:!MD5;
>     #    ssl_prefer_server_ciphers   on;
>
>     #    location / {
>     #        root   html;
>     #        index  index.html index.htm;
>     #    }
>     #}
>
> }
>
>
> With above configuration, and with proxy_pass set, it gices 502 error.
> When I try to access
> ws://127.0.0.1:80 using chrome websocket client.
>
> I will highly appreciate if someone can give right pointer to resolving
> this.
>
> Thanks a ton
>
> Hemant
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20131018/f7da9d2b/attachment-0001.html>


More information about the nginx mailing list