I know there are several questions like this but i can't find one solving my problem for a project which is not in the server root. I have the following situation: I have an Apache server which runs several projects like:
0.0.0.0/project1
0.0.0.0/project2
I added a node.js project let's call it nodeproject
. With ProxyPass I am passing requests made to 0.0.0.0/nodeproject
to 0.0.0.0:8080
where my node server is running. This is all working fine except the websocket configuration for socket.io.
In my /etc/apache2/apache2.conf
file i placed this code to do the proxying. mod_proxy_wstunnel
is enabeld Which i basically copied from here.
ProxyRequests off
ProxyVia on
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/nodeproject/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:8080/$1 [P,L]
ProxyPass /nodeproject/socket.io http://localhost:8080/socket.io
ProxyPassReverse /nodeproject/socket.io http://localhost:8080/socket.io
<Location /nodeproject>
ProxyPass http://localhost:8080
ProxyPassReverse http://localhost:8080
</Location>
The failing request looks like this:
ws://0.0.0.0/nodeproject/socket.io/?EIO=3&transport=websocket&sid=MDuVcHmt3T1sa8ruAAAa
and i get a Bad Request 400 response.
I am not an expert in configuring this kind of stuff where did I go wrong?
Thanks in advance!