Using Apache on Ubuntu 15.04 I'm trying to effectively remove the port 3000 from the URL as well as to change the path to http://example.com/{app}/socket.io...
Using ProxyPass and ProxyPassReverse I've removed the port from the URL effectively as well as to update the server and client side accordingly to change the path.
Virtual Hosts changes:
ProxyPass /path/ http://example.com:3000/path/
ProxyPassReverse /path/ http://example.com:3000/path/
The server side changes that I made was the following:
var io = require('socket.io')(http, {path: '/path/socket.io' });
app.get('/path/', function(req, res){
and the client changes that I made was the following:
var socket = io({path: '/path/'});
Everything appeared to run smoothly until I opened up my console log and saw a plethora of GET
requests while using chrome. This'll definitely kill my bandwith and I guess I somehow managed to not listen to the socket correctly which resulted in the mass amount of GET
requests.
Could someone provide some guidance into what I may possibly be doing wrong?
You're seeing a large number of requests as socket.io is falling back to long polling as Apache is not proxying the websocket connection you'll need to enable this with
mod_proxy_wstunnel
then add
ProxyPass "/path/socker.io" "ws://localhost:3000/"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With