-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: upgrade http-proxy module for bug fixes
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.
- Loading branch information
1 parent
7b1ef5e
commit 09c75fe
Showing
4 changed files
with
239 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.