Skip to content
This repository was archived by the owner on Feb 24, 2024. It is now read-only.

Commit f5f1768

Browse files
committed
Explicitly rejecting websocket extensions, just in case http-party/node-http-proxy#1508
1 parent 2db8cb1 commit f5f1768

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Lobby.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,17 @@ const ProxyOptions =
392392
port: 1234
393393
}
394394
}
395+
396+
function OnProxyWebsocketRequest(proxyReq, req, socket, options, head)
397+
{
398+
console.log(`OnProxyWebsocketRequest; ${JSON.stringify(proxyReq,null,'\t')}`);
399+
proxyReq.setHeader('Sec-WebSocket-Extensions','');
400+
//proxyReq.setHeader('X-Special-Proxy-Header', 'foobar');
401+
};
402+
395403
const Proxy = httpProxy.createProxyServer(ProxyOptions);
396404
//httpProxy.createServer(ProxyOptions).listen(8000);
397-
405+
Proxy.on('proxyReqWs',OnProxyWebsocketRequest);
398406

399407
function OnHttpRequest(Request,Result)
400408
{

0 commit comments

Comments
 (0)