-
I am in the process of updating to the latest version of pact-js and I am encountering issues configuring a web proxy for use with the Verifier. My approach with pact 9.17 (and pact-node 10.17) was to use global-agent to leverage our https proxy and this worked successfully when my providerBaseUrl for the pact Verifier would otherwise be blocked by our web proxy. When updating to pact 12.3.0, I noticed several issues with the above approach. Initially I had to add NO_PROXY configuration for 127.0.0.1. Subsequently, I saw runtime issues with the pact parseBody.js behavior as the proxy request was already in a finished/headersSent state when this event hook was attempting to update the request. However, even after manually modifying this behavior I was observing the global agent proxy on https was still not actually being leveraged and my provider requests were not going through the web proxy. Similary, setting environment variables for HTTPS_PROXY or HTTP_PROXY does not seem to impact the underlying pact internal proxy forwarding from local to the provider URL. What is the proper way to configure use of a corporate proxy with the latest Pact Verifier? Is this a feature that would need to be requested as an enhancement (e.g. adding an optional arg for an http Agent to the Verifier)? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Good question. I thought this was supported on the latest and it would be surprising to me that we haven't bumped into this already. There are potentially 2 places this is impacted:
I suspect if you couldn't resolve it in JS, it's in the core verifier. Were you able to find the source of where the requests were stuck? Looking at the core, it uses the Reqwest library and that has code to detect the system proxies and use them. |
Beta Was this translation helpful? Give feedback.
-
It looks like others encounter this issue with body-parser and proxy middlewares - this is the same manifestation I get if I either use a global agent, or explicitly provide an agent to the proxy:
It seems like the request buffer gets read to completion by the parser middleware with the expectation that the I think this might need to be an enhancement request to allow the Verifier to accept an option for proxy support. Here's what I tried that seemed to work:
Could something like the above be added as enhanced support for corporate proxies from the Verifier? |
Beta Was this translation helpful? Give feedback.
-
I've created #1188 to track this |
Beta Was this translation helpful? Give feedback.
It looks like others encounter this issue with body-parser and proxy middlewares - this is the same manifestation I get if I either use a global agent, or explicitly provide an agent to the proxy:
It seems like the request buffer gets read to completion by the parser middleware with the expectation that the
proxyReq
event will re-write just for the proxy request. But it seems like this may break any piping behavior used by http agents in between this sequence.I think this might need to be an enhancement request to allow the Verifier to a…