• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Question How do you enable WebSockets for nodejs and nginx

MeekSqueek

New Pleskian
Hi Forum members,

I need to enable websockets for a nodejs application. The server is Centos 6 with Nginx and Nodejs4. I've tried to add some directives to the nginx config:

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://socket_nodes;

But "proxy_pass" directive is not allowed...

Any pointers would be gratefully received.

Thanks in advance.
 
Hi,

Did you find a solution for this ?
I'm facing the same problem, I didn't know the "proxy_pass" directive was not allowed,
But even if it were, how do you know where to proxy to ? ie: http://socket_nodes, where is that defined?
 
Hi,

Did you find a solution for this ?
I'm facing the same problem, I didn't know the "proxy_pass" directive was not allowed,
But even if it were, how do you know where to proxy to ? ie: http://socket_nodes, where is that defined?

I didn't find a solution to this but I did find a work around.

I turned off Proxy Mode (Nginx proxies requests to Apache. Turn off to stop using Apache.) as I had read somewhere that Apache doesn't support sockets. This causes the site to be served by nginx and passenger running within nginx and now it works a treat.

Have a go by turning off Proxy Mode in the Apache & nginx Settings page under the nginx settings area. If it works for you please add a reply to that effect. :)

Thanks

Simon.
 
Back
Top