Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single use proxy in multi-tenant application #1655

Open
thgh opened this issue Dec 9, 2023 · 0 comments
Open

Single use proxy in multi-tenant application #1655

thgh opened this issue Dec 9, 2023 · 0 comments

Comments

@thgh
Copy link

thgh commented Dec 9, 2023

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: ...
    })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant