RoutingProxy.proxyRequest modifies the options parameter
Problem
Node: v0.7.6 http-proxy: v0.8.0 (via NPM) MacOS Problem: RoutingProxy.prototype.proxyRequest modifies the 'options' parameter by adding new properties to the object. This is unexpected and leads to unintended consequences as described below. I was expecting the API to not modify the options parameter. Scenario: I have a single node process that runs two reverse proxies on two different TCP ports: an HTTPS->HTTP proxy and HTTP->HTTP proxy. The two reverse proxies use two instances of RoutingProxy, but the data structure that defines routing rules is shared between the two proxies. Specifically, the object instance I pass as 'options' parameter to RoutingProxy.proxyRequest has a global lifetime. What I notice is that whenever the first routing request is HTTPS, the modifications RoutingProxy.proxyRequest makes in the 'options' parameter cause subsequent HTTP routing requests to fail. It appears that the RoutingProxy is picking HTTPS module instead of HTTP to make the outbound request to the backend.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: RoutingProxy.proxyRequest modifies the options parameter
Could you create a failing test that replicates the issue?
Trust Score
1 verification
- 1
Could you create a failing test that replicates the issue?
Could you create a failing test that replicates the issue?
Validation
Resolved in http-party/node-http-proxy GitHub issue #248. Community reactions: 0 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep