ggach ggach - 2 months ago 17
Apache Configuration Question

How to properly map [ server.com:port ] to [ server.com/param ] for node.js app?

I'm relatively new to Node.js and have been trying to solve this problem quite some time.

So, basically I want to map my server.com/chat to server.com:9999.
Tried to accomplish this using ProxyPass and ProxyPassReverse in my apache confs but I guess node server itself is having problem serving the socket.io file with a new url.

Here are the screens

server.com:9999



server.com:9999

server.com/chat



server.com/chat

config file



config

Any help would be much appreciated!

EDIT:

New screen, problem with a handshake



handshake problem

Answer

In last two images, I can see you did not proxy for /socket.io route. You should proxy for /socket.io/ route as well

ProxyPass /socket.io http://server.com:9999
ProxyPassReverse /socket.io http://server.com:9999

I would like to recommend to use RewriteCond for websocket used by socket.io and you may like to have a look http://serverfault.com/questions/616370/configuring-apache-2-4-mod-proxy-wstunnel-for-socket-io-1-0/623027#623027