You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varhttp=require('http');varserver=http.createServer(function(req,res){
......//donormalrequest}).listen(1337);varaccept=function(request){if(ok){returntrue;}else{returnfalse;}}server.on('upgrade',function(request,socket,head){if(!accept(request)){//here the http-proxy will not work!socket.write("HTTP/1.1 406 Not Acceptable\r\n");socket.write("Connection: close\r\n");socket.write("\r\n");socket.end();return;}
......//dowebsocketrequest});
The text was updated successfully, but these errors were encountered:
@kd128 Can you see if running a socket.destroy() rather than a socket.end() behaves differently? But it is possible this is a bug. If you can add a fully working, minimal test case, this would expedite the process :). And ideally in the form of a pull request ;)
I've added a complete test case for this bug here. Switching between socket.end and destroy does not have any effect. Proxied websocket connections that are rejected are left open. This is particularly problematic in browsers (other than Safari for some reason) because a websocket stuck in the connecting state actually blocks other attempts to connect to the same server, even from other tabs.
it happen when sever dothing like
The text was updated successfully, but these errors were encountered: