HttpClientBuilder.Build() ignores HTTP(S)_PROXY (auth-server OAuth/DCR calls bypass forward proxy)
Open
Beginner friendly
Nobody has claimed this yet.
needs-triage
- Dominant language
- Go
- Stars
- 2.2k
- Forks
- 300
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 184
Description
Problem
HttpClientBuilder.Build()(pkg/networking/http_client.go) builds itshttp.Transportwithout aProxyfield.- That means clients it produces ignore
HTTP_PROXY/HTTPS_PROXY/NO_PROXY(a zero-valuehttp.TransporthasProxy: nil, unlikehttp.DefaultTransport). - The embedded auth server's upstream OAuth/DCR client is built this way (
pkg/authserver/upstream/oauth2.go→newHTTPClientForHost→NewHostScopedClientBuilder().Build()). - Where the upstream is only reachable via an explicit forward proxy, the token-exchange and DCR calls bypass the proxy and fail even with the proxy env vars set.
- The vMCP tool-forwarding path is unaffected, since it uses
CloneDefaultTransportWithDialControl, which already setsProxy: http.ProxyFromEnvironment.
flowchart LR
Pod["MCPRemoteProxy pod<br/>(HTTPS_PROXY set)"]
Pod -->|"tool-forwarding client<br/>CloneDefaultTransportWithDialControl"| P1["honors proxy"]
Pod -->|"auth-server OAuth client<br/>Build → Proxy: nil"| P2["ignores proxy"]
P1 --> FP["forward proxy"] --> UP1["upstream MCP host<br/>reachable"]
P2 --> DIRECT["direct egress"] --> UP2["IP-allowlisted token<br/>endpoint → 403"]
classDef ok fill:#e7f7ec,stroke:#2e7d32,color:#1b3d24;
classDef bad fill:#fdecea,stroke:#c62828,color:#5b1a15;
class P1,FP,UP1 ok;
class P2,DIRECT,UP2 bad;
Expected behavior
- Clients built by
HttpClientBuilder.Build()honorHTTP(S)_PROXY/NO_PROXY, consistent withhttp.DefaultTransportand the vMCP path.
Proposed fix
- Set
Proxy: http.ProxyFromEnvironmenton the transport inBuild(). - When the proxy address is itself private, the existing
AllowPrivateIPsoption covers reaching it.
I'm planning to submit a PR for this.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pkg/networking/http_client.go and inspect HttpClientBuilder.Build(), then trace its use through pkg/authserver/upstream/oauth2.go and newHTTPClientForHost. Verify that the built client honors HTTP_PROXY, HTTPS_PROXY, and NO_PROXY consistently with the vMCP transport, including the existing AllowPrivateIPs behavior; run the relevant Go tests after making the change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- authentication, networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100