Mod Rewrite and proxy for Socket.io
The question is how do you configure WHM Include Editor to mod rewrite virtual hosts?
Specifically, I'm having the following issue...
I'm running Node and Socket.io servers behind WHM/Apache 2.4.2.
The Node server works through a reverse proxy at port 80 by placing
ProxyPass /backend
in the Include Editor -> Post VirtualHost Include.
Socket.io piggybacks the Node server at localhost:8082/socket.io
I have mod_proxy and mod_proxy_wstunnel installed via Easy Apache 4.
However, when Socket.io tries a web socket connection, the request 400s and reverts to long polling.
I've tried placing
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:8082/$1 [P,L]
ProxyPass /socket.io
into all three Include Editor locations to no avail. I've also tried Rewrite Inherit. (I've tried to just make it rewrite anything.. won't do it).
Several others asked this question, but the response was always "put it in .htaccess." However, .htaccess does not accept ProxyPass.
Any ideas?
-
Hello, You may want to try editing the template for the VirtualHost per the document located at: Custom Templates - EasyApache - cPanel Documentation This will allow you to configure the entries within the VirtualHost instead editing the global Apache configuration. Keep in mind these custom modifications changes are unsupported Thank you. 0
Please sign in to leave a comment.
Comments
1 comment