'not able to establish socket connection with server running on different port based on path/endpoint

client --

var socket = io(
{
  transports : ['polling'],
  path : '/mysocket'
});

server--

io = require('socket.io')(server,{
   path : '/mysocket'
});

nginx --

location /socket/ {
  proxy_pass http://example.com:3005
}

https://example.com is running on two ports 3003 & 3005 all endpoints are connected to 3003 and my end point is connected to 3005 where my socket connections will be done,but the the socket is not connecting to 3005 instead it is connecting to 3003.



Solution 1:[1]

it was nginx where i was missing i need to add

location /socket/ {
  proxy_http_version 1.1
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
  proxy_pass http://example.com:3005;
}

this solved my issue

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Appam Venkatesh