http-proxy-middleware icon indicating copy to clipboard operation
http-proxy-middleware copied to clipboard

Many on onOpen But only one onClose

Open 823639792 opened this issue 4 years ago • 2 comments
trafficstars

yarn why http-proxy-middleware OR npm ls http-proxy-middleware output (mask private folder names with *****)

[email protected]

Describe the bug (be clear and concise)

If I proxy ws Set the callback with CreateProxyMiddleware

{ onClose: function (){ console.log("onClose"); }, onProxyReqWs: function(){ console.log("onProxyReqWs"); }, onOpen: function(){ console.log("onOpen"); } }

can receive many onProxyReqWs and onOpen but only receive one onClose event. and the result is Socket object will leak, memory increase。

Step-by-step reproduction instructions

1. ...
2. ...

Expected behavior (be clear and concise)

...

What http-proxy-middleware configuration are you using?

function GetProxyParam(){
    var reg = `^/${Config.http_stream_port}`;
    var rewrite = {};
    rewrite[reg] = "";
    return {
        target: `http://localhost:${Config.http_stream_port}`,
        changeOrigin: true,
        ws: true,
        logLevel: "debug",
        pathRewrite: rewrite,
        onClose: function (){
            console.log("onClose");
        },
        onProxyReqWs: function(){
            console.log("onProxyReqWs");
        },
        onOpen: function(){
            console.log("onOpen");
        }
    }
}

What OS/version and node/version are you seeing the problem?

windows   node v12.20.1

Additional context (optional)

...

823639792 avatar Jul 02 '21 12:07 823639792

Can you please provide a minimal example and reproducible steps for investigation.

chimurai avatar Jul 02 '21 13:07 chimurai

Same as: https://github.com/http-party/node-http-proxy/issues/1510 Maybe is a node-http-proxy bug

823639792 avatar Jul 05 '21 05:07 823639792