fix(http): use proxy agent setup that supports proxy env variables with no_proxy#781
Conversation
7e31c2e to
69c9dc5
Compare
|
I am not sure all the explicit http_proxy and https_proxy handling is necessary in the current codebase. Axios already handles those environment variables automatically. From https://github.com/axios/axios#request-config: {quote} |
I just read issue axios/axios#5256 (400 Bad Request using axios proxy default handling) and now I understand that you handle the proxy explicitly to avoid this issue. Sorry for the noise ! |
|
@jontze can you please resolve the merge conflicts when you've time? |
Related to OpenAPITools#762 In the linked PR, the proxy config was restored, but it didn't respected the `NO_PROXY` | `no_proxy` configuration. This commit moved to a different approach that is working with all common proxy environment variables.
69c9dc5 to
57e947a
Compare
|
@jontze thank you I'll merge it next monday as we try to avoid changes on Friday :) When you've time, can you please also PM me via Slack? https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g |
|
🎉 This PR is included in version 2.14.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
PR merged. Please give it a try with the latest release. |
|
@wing328 : I've just tested the version 2.14.1 in my corporate environment and it works fine. Thanks to both of you ! |
Fixes a bug introduced in #762, where the "no-proxy" environment configuration was ignored.
With this PR I moved from the usage of
https-proxy-agenttoproxy-agent. This was done ashttps-proxy-agentwas configured to take the proxy url from the environment but the library itself doesn't handleNO_PROXY/no_proxyconfiguration.proxy-agenton the other side, is sitting on top of thehttps-proxy-agentandhttp-proxy-agentlibrary and decides if the proxy is used based on the request URL and the domains specified in the "no proxy" environment variables.To test this
HTTP_PROXY,HTTPS_PROXY,http_proxy,https_proxy,NO_PROXY,no_proxy.generator-cli.repository.downloadUrlconfigno_proxyandNO_PROXYenvironment variables OR if you don't have a mirror at hand, just add the default domain specified in config.schema.json and ensure that you have a way to verify that the traffic went not through the proxy.