-
Notifications
You must be signed in to change notification settings - Fork 25
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
ensure HTTP requests use proxy env vars #597
Conversation
Updated all instances of `http.Transport` to include the `Proxy` field set to `http.ProxyFromEnvironment`. This ensures that the application respects proxy configuration defined by the `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` environment variables. ### Changes: - Modified `http.Transport` initialization across the codebase to use: ```go Proxy: http.ProxyFromEnvironment ``` - Ensured TLS configurations remain intact by preserving `TLSClientConfig`. ### Why: - Previously, HTTP requests bypassed proxy settings due to missing configuration in the transport layer. - This fix enables compatibility with proxied environments, aligning with standard Go behavior. ### Impact: - All HTTP and HTTPS traffic now adheres to proxy settings. - Domains listed in `NO_PROXY` bypass the proxy as expected. ### Verification: - Tested with proxy environment variables set (`HTTP_PROXY`, `HTTPS_PROXY`). - Verified requests route through the proxy and `NO_PROXY` works as intended.
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.
LGTM
@ncsc-ie-devs Can you run |
That should be done now - sorry about the delay. |
LGTM & works |
@koplas should we additionally add a remark in a general place in the documenation? |
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.
LGTM
Description
This merge request resolves Issue 596 by ensuring that all HTTP and HTTPS traffic uses the proxy configuration specified in the environment variables (
HTTP_PROXY
,HTTPS_PROXY
,NO_PROXY
).Changes Made
http.Transport
to include theProxy
field:TLSClientConfig
settings, preserving secure connections.Motivation
The issue described in Issue 596 identified a shortfall where proxy settings were ignored, causing failures in proxied environments. This fix ensures compliance with Go's standard proxy behavior and improves usability for users in corporate or secured networks.
Verification
Environment Setup:
HTTP_PROXY
,HTTPS_PROXY
, andNO_PROXY
.NO_PROXY
.Test Cases:
NO_PROXY
-listed domains.Impact
net/http
proxy handling.Closes
Closes Issue 596.