I'm trying to set up Socket.io connection in Apache using Node.js via ProxyPass. The server works just fine and returns data upon fetch, but Socket.io fails to connect for some reason. I tried setting different path option within Socket.io but that didn't work either.
httpd.conf
<VirtualHost 123.45.789:8005>
<Location "/node">
ProxyPass http://localhost:5555/
</Location>
</VirtualHost>
Server
// Bunch of require() statements..
const server = http.createServer(app);
const io = require('socket.io')(server.listen(5555), {
path: '/' // Tried '/node', 'node', '/node/'
});
io.on('connection', socket => {
console.log('CONNECTED!') // This never logs obviously.
});
Client
import { io } from "socket.io-client";
const uri = 'http://123.45.789:8005';
// const uri = 'http://123.45.789:8005/node';
// const uri = 'http://123.45.789:8005/node/';
// const uri = 'http://123.45.789:8005/node/socket.io';
// const uri = 'http://123.45.789:8005/node/socket.io/';
const socket = io({
path: uri,
rejectUnauthorized: false,
});
socket.on('connect', () => console.log('CONNECTED!')); // Never logs either.
Console Error
GET http://10.***.***.***:8080/socketjs-node/info?t=1639773280240 net::ERR_CONNECTION_TIMED_OUT
I'm totally lost.. any help would be great, thanks.