Skip to content
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

HTTP_PROXY is ignored #2970

Open
ffalor opened this issue Aug 29, 2023 · 1 comment
Open

HTTP_PROXY is ignored #2970

ffalor opened this issue Aug 29, 2023 · 1 comment

Comments

@ffalor
Copy link

ffalor commented Aug 29, 2023

Problem statement

Setting HTTP_PROXY env variable is ignored. HTTPS_PROXY works. If env variables are not the best way to set a proxy for a client generated by this tool what is?

Swagger specification

N/A

Steps to reproduce

  1. Generate a client from a swagger spec
  2. Set HTTP_PROXY
  3. Proxy is ignored

Environment

swagger version: 0.30.5
go version: 1.19.3
OS: Mac Ventura 13.5

@fredbi
Copy link
Contributor

fredbi commented Dec 21, 2023

@ffalor
Proxy environment variables are handled by the net/http default client and the http.Transport.
See
https://pkg.go.dev/net/http#ProxyFromEnvironment
and
https://pkg.go.dev/golang.org/x/net/http/httpproxy#pkg-overview

The client runtime normally uses the http.DefaultTransport (but in the case of specific TLS config).

So this is quite weird. go-openapi and the generated client do not tamper with proxy settings.

You can alway override the proxy behavior using the Proxy field of a http.Transport passed as roundtripper .to the client runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants