node-http-proxy
node-http-proxy copied to clipboard
Single use proxy in multi-tenant application
trafficstars
Hi, would http-proxy introduce a memory leak if a proxy server was created for each request? At what point should proxy.close() be called? (or it doesn't matter as the server does not listen on a port?)
// Each request:
const proxy = createProxyServer({
target: ...,
changeOrigin: true,
followRedirects: false,
})
proxy.on('proxyReq', function (proxyReq, req, res, options) {
...
proxyReq.write(request.body)
})
proxy.web(request, response, {
target: ...
})