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

How to destroy created proxy

Open rizrmd opened this issue 7 years ago • 1 comments

I am using http-proxy-middleware this way:

      let addons = {
          myaddon1: {
                 proxy:  proxy({
                     target: `http://localhost:${addonPort}`,
                     changeOrigin: true,
                     ws: true,
                    logLevel: "debug"
                })
           }
      }

        app.use('/:name/:type', function (req, res) {
            if (addons[req.params.name]) {
                addons[req.params.name].proxy(req, res);
            } else {
                res.send(`Add-on ${req.params.name} not found.`);
            }
        });

when i delete addons[req.params.name].proxy somehow the proxy is still serving websocket, my question is how to completely destroy the proxy ?

rizrmd avatar Jul 09 '18 13:07 rizrmd

I have this same issue. I tried to use express-dynamic-middleware and that will remove the route, but somehow the websockets do not get cleared. So while the normal routes work, any active websockets will not be purged.

geiseri avatar May 07 '19 11:05 geiseri