• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

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