angularjs - Why does angular-socket-io complain with 'Error during WebSocket handshake: Unexpected response code: 400?' -


i have node application (angular-fullstack) moved http https. working, socket connection isn't. missing?

in socketfactory have:

var iosocket = io('https://localhost', {   path: '/socket.io-client' }); 

which believe causes transport use 'wss://'. https connection good. time, believed somehow nginx not handling proxy correctly. incorrect.

next, changed form 'https://locahost' 'https://xxx_actual_server_url_xxxx' , works after initial page reload. see one:

websocket connection 'wss://xxx_actual_server_url_xxxx/ socket.io-client/?eio=3&transport=websocket&sid=y4_ckvyterz_f1zcaaak'  failed: error during websocket handshake: unexpected response code: 400 

what causing this? , how around it? not doing load balancing or , running development server 'grunt serve'. thoughts?

thanks!

after searching , hunting, discovered when using sockets nginx needed add following proxy stuff:

proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; 

having done that, good. else. full set of parameters forwarding proxy nginx is:

 location / {     proxy_set_header   x-real-ip $remote_addr;     proxy_set_header   host      $host;     proxy_pass https://127.0.0.1:9000;     proxy_http_version 1.1;     proxy_set_header upgrade $http_upgrade;     proxy_set_header connection "upgrade";     proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;   } 

thanks looked @ this!


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -