-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Use http-proxy-middleware instead of http-proxy. #359
Conversation
…ss functionality.
Change to use http-proxy-middleware instead of http-proxy.
Use http-proxy-middleware instead of http-proxy.
Thanks |
👍 for this PR. It adds support for native web sockets which is currently not working in the latest release. Would resolve #283. Also seems like the HTPM has much more mature documentation. One issue I did have though is that the syntax for describing the url to match is a little different. Before this PR: ...
proxy: {
'/api/*': {
...
}
}
... After: ...
proxy: {
'/api': {
...
}
}
... |
@sokra Should there be some documentation regarding the proxy path tweak? |
Also I noticed a crash when the server being proxied to shuts down, opened an issue with the HTPM since the trace looks like its on them |
Thanks for the merge. If there is a documentation repository I can make the changes for the proxy path tweak. I tested the |
I did run it on my setup and it was definitely not obeying the I don't have a great open source example for a demo on hand. @sokra added a rewrite in 33ebd1f. If you can prove that this is unnecessary feel free to and then that check can be removed. |
@sokra What's the schedule for (I can't install it straight from git because npm doesn't seem to run the |
+1, I wait for the npm release. EDIT: Ah, nevermind, I noticed P.S. It would be nice if there was some changelog or upgrade guide for 2.0.0. |
@mik01aj the 1.14.1 release has it. |
Use http-proxy-middleware instead of http-proxy.
The `bypass` feature was no longer working because the code added the bypass method as middleware AND `httpProxyMiddleware` as middleware. However, if a `bypass` method is given, it should only use that as middleware. This was caused in #359, and effects `1.15.0` and the 2.x branch.
The `bypass` feature was no longer working because the code added the bypass method as middleware AND `httpProxyMiddleware` as middleware. However, if a `bypass` method is given, it should only use that as middleware. This was caused in #359, and effects `1.15.0` and the 2.x branch.
The `bypass` feature was no longer working because the code added the bypass method as middleware AND `httpProxyMiddleware` as middleware. However, if a `bypass` method is given, it should only use that as middleware. This was caused in #359, and effects `1.15.0` and the 2.x branch.
The `bypass` feature was no longer working because the code added the bypass method as middleware AND `httpProxyMiddleware` as middleware. However, if a `bypass` method is given, it should only use that as middleware. This was caused in #359, and effects `1.15.0` and the 2.x branch.
Apparently this whole config option was removed in PR #359.
Any guidance on how to make this work behind a corporate http proxy? |
I've found that the configuration of the node-http-proxy (NHP) library doesn't allow for some basic use cases (including my own). For example, it doesn't seem possible (through configuration only) to proxy a request from
host1.com/api/user/1
tohost2.com/user/1
.This PR changes the implementation to use the http-proxy-middleware (HPM) library which is built on top of the original NHP, so all current configurations should work. The HPM library has a lot more configuration options available.
I have ported over
proxyOptions.bypass(...)
, but without aproxy
object, there is no need forproxyOptions.configure(...)
anymore.Comments in the code can be removed on request, I wanted to make my intent clear. Cheers