Honor proxy env in overridden default HTTP client#252
Merged
Conversation
NewDefaultClient replaces the global http.DefaultClient but built its
transport from a bare http.Transport{} (Proxy: nil), which dropped the
HTTP(S)_PROXY/NO_PROXY support that the stock http.DefaultTransport
provides via http.ProxyFromEnvironment. As a result every http.Get in
the CLI (and in the helm-charts code it embeds) ignored proxy settings,
so installs on proxied/offline hosts failed resolving api.github.com
directly instead of dialing the proxy.
Set Proxy: http.ProxyFromEnvironment on the replacement transport.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
yotamazriel
approved these changes
Jun 22, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Restore proxy support on the HTTP client that replaces the global
http.DefaultClient.pkg/api/utils.goruns aninit()that swapshttp.DefaultClientfor one built around a barehttp.Transport{}. A bare transport hasProxy: nil, whereas the stockhttp.DefaultTransportsetsProxy: http.ProxyFromEnvironment. The override therefore disabledHTTP_PROXY/HTTPS_PROXY/NO_PROXYhandling process-wide — including for thehttp.Getcalls in the embeddedhelm-chartscode (e.g.pkg/githubrelease lookups and chart downloads).The fix sets
Proxy: http.ProxyFromEnvironmenton the replacement transport.Why
On a proxied/offline host,
leap server installfailed with:even with the correct
HTTPS_PROXYexported. The transport never consulted the proxy env, so it resolvedapi.github.comdirectly (no direct internet) and failed. This blocked online-mode installs behind a corporate proxy.Reviewer notes
CustomRoundTripper's 401→ErrAuthbehavior is unchanged.go build ./...andgo vet ./pkg/api/pass.leapbinary need a rebuild to pick this up.🤖 Generated with Claude Code