cant connect to node server via after mapping an address to port

im very new to nodejs so bare with me

so i have a nodejs server which i use to inject live data to my php/laravel website via i run my nodejs server in port 3001 and apache is using port 80

so my node server is running on

so i noticed clients who use vpn or proxy cant connect to my nodeserver address and websocket connection fails for them

after asking in this question it was suggested its bcuz vpn is fire walling unusual ports

nodejs server doesn't respond when clients use vpn or proxy

so i maped a address to 3001 port , so basically ---proxying--->

so now when i go to i get

Cannot GET /

which means its working but in my homepage when i try to connect to the server via it fails ... homepage source

    <script src="" ></script>


    const  socket = io.connect("" ,  {transports:['websocket']});

    socket.on('connect', function () {
        console.log('connected!!!') ; 



not sure why is this happening but in my console i see it trying to connect to this address

WebSocket connection to 'ws://' failed: Error during WebSocket handshake: Unexpected response code: 301
r.doOpen @ index.js:83

but shouldnt it try the ? considering i gave to io.connect ?

it works fine when i try connecting via ip:port ... try this address to connect via ip:port instead of proxy address

Read more here:

Content Attribution

This content was originally published by hretic at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: