-
Notifications
You must be signed in to change notification settings - Fork 3
Very slow request #7
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
Comments
Sharing an agent will share the TCP connections to the server. This means that multiple different clients hitting the proxy will share the same TCP connection back to the server (possibly sending their requests interleaved), which, depending on your back end, may have significant security implications (e.g. if you use middleware that only does authorization checks on a connection once and caches the response). I think you can get this performance on the user-end by just passing in an Is your back-end HTTPS (not HTTP) by any chance? HTTPS has a huge per-connection overhead, but an HTTP backend should be relatively fast even with a new connection/agent each time (although, of course, still slower than not doing extra work). As long as your proxy-to-backend traffic flows only through a private network, you can avoid using HTTPS. |
Thanks for your answer. This is my code :
remote certifcates are not signed, and local too. Seems faster when https -> http, but https -> https is just very slow. And there is not a lot of request... I'm the only one using this (localy by setting 127.0.0.1:8888 in the browser). Do you know the difference between:
Because it's the only think I change in common.js |
Yeah, I'm not surprised https -> https proxying is slow, but there's no need for it in most cases (if you're using a proxy, then probably the back end is not exposed to the internet, so then there's no reason to use https between two of your own private services that aren't exposed to the internet). I think
|
Hello,
I was facing an issue on node 20 with the proxy. Very slow proxy. I found the solution here:
I changed this in common.js setupOutgoing :
Regarding the doc, setting the agent to false seems to create a new one each time...
I'm not a HTTP agent expert, but does it make sense to create a new one each time ?
After that change, proxy are really really fast... 10x time faster.
The text was updated successfully, but these errors were encountered: