-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix: upgrade http-proxy module for bug fixes #1345
Conversation
The http-proxy module was significantly outdated, and was missing many bugfixes to support node newer than 0.10, as we as a refactor and simplification of their codebase. This commit upgrades the http-proxy dependency, and refactors the proxy middleware to utilize the new API. `parseProxyConfig` (an internal function) now takes the proxy configuration object and converts it into an array of "ProxyRecord" objects, sorted by path. A ProxyRecord object contains: * `host` The remote proxy host * `port` The remote proxy port * `baseUrl` The remote proxy path * `path` The local URL path (that triggers the rewrite) * `https` Boolean to determine if the remote connection will be made with SSL. * `proxy` The instance of http-proxy. This change was necessitated by the removal of http-proxy's RoutingProxy API, and the desire to only create one proxy instance per configuration item. The middleware simply determines if the current request matches a known proxy path, and calls the proxy's `.web` and `.ws` methods with the current request and response objects. The relevant unit tests were rewritten in light of these changes.
big 👍 |
This is great, a big thanks first of all! |
@@ -167,7 +167,7 @@ | |||
"chokidar": ">=0.8.2", | |||
"glob": "~3.2.7", | |||
"minimatch": "~0.2", | |||
"http-proxy": "~0.10", | |||
"http-proxy": "~1.8.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change this to ^1.11.1
please?
ping @terinjokes |
@dignifiedquire sorry, i've been busy and didn't check in on this. I no longer remember why I modified |
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
Thanks |
Merged as bcce563 |
The http-proxy module was significantly outdated, and was missing many
bugfixes to support node newer than 0.10, as we as a refactor and
simplification of their codebase.
This commit upgrades the http-proxy dependency, and refactors the proxy
middleware to utilize the new API.
parseProxyConfig
(an internal function) now takes the proxyconfiguration object and converts it into an array of "ProxyRecord"
objects, sorted by path. A ProxyRecord object contains:
host
The remote proxy hostport
The remote proxy portbaseUrl
The remote proxy pathpath
The local URL path (that triggers the rewrite)https
Boolean to determine if the remote connection will be madewith SSL.
proxy
The instance of http-proxy.This change was necessitated by the removal of http-proxy's
RoutingProxy API, and the desire to only create one proxy instance per
configuration item.
The middleware simply determines if the current request matches a known
proxy path, and calls the proxy's
.web
and.ws
methods with thecurrent request and response objects.
The relevant unit tests were rewritten in light of these changes.