-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[reverse_proxy] No possibility to force a NO_PROXY for reverse_proxy directive #6538
Comments
I don't understand. We use caddy/modules/caddyhttp/reverseproxy/httptransport.go Lines 330 to 339 in 4ade967
I apparently have a related draft PR that I've forgotten (#6399), but not 100% if it's helpful or not 🤔 I need to dwell on the issue.
What's this fork you're speaking of? |
I don't want to use I could use The post you mention is linked to my problem, because I can't set Using the The fork I mentioned is my own, here is the diff : diff --git a/modules/caddyhttp/reverseproxy/httptransport.go b/modules/caddyhttp/reverseproxy/httptransport.go
index 80a49806..56b37a65 100644
--- a/modules/caddyhttp/reverseproxy/httptransport.go
+++ b/modules/caddyhttp/reverseproxy/httptransport.go
@@ -298,7 +298,10 @@ func (h *HTTPTransport) NewTransport(caddyCtx caddy.Context) (*http.Transport, e
// negotiate any HTTP/SOCKS proxy for the HTTP transport
var proxy func(*http.Request) (*url.URL, error)
- if h.ForwardProxyURL != "" {
+ if h.ForwardProxyURL == "no_proxy" {
+ caddyCtx.Logger().Warn("setting transport proxy to nil --> no proxy")
+ proxy = nil
+ } else if h.ForwardProxyURL != "" {
pUrl, err := url.Parse(h.ForwardProxyURL)
if err != nil {
return nil, fmt.Errorf("failed to parse transport proxy url: %v", err) It's working as expected, I still have my HTTP(S)_PROXY var, my NO_PROXY var, and I can tell caddy to not use any proxy for reverse proxying to a hostname which is not in the NO_PROXY. I hope it is clear, I may give a full scenario in example if needed. Thanks |
I guess my PR could include a proxy provider |
Yes it should be enough I think. 👌 |
Hello,
I have a use case where I'm behind a proxy, the HTTP(S)_PROXY environment variables are set, and my reverse_proxy directive uses placeholders (i.e. Caddy doesn't know in advance the name of the hostname). All the webservers are in a local network (docker network).
It looks like this :
It worked fine until v2.7.0 when the
ProxyFromEnvironment
was added to the reverse_proxy directives.Now Caddy tries to use the proxy if I don't add the webserver hostname in the NO_PROXY environment variable, which I can't because I don't know new webservers that'll come (we also have tls on demand activated).
I found a solution (in a fork) by adding the possibility to add "no_proxy" to the
forward_proxy_url
setting, which set the proxy to nil. The reverse proxy directive looks like this using this setting :Is there a better way I didn't find ?
Thanks
The text was updated successfully, but these errors were encountered: