-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: Add support for SRV backends #3180
Conversation
Why not |
Because it's not a network type; you could in theory have TCP or UDP protocol for SRV lookups, see here: https://golang.org/pkg/net/#Resolver.LookupSRV |
@mholt, the SRV functionality works as expected. I can provide only the address without ports now and it can proxy requests successfully. I see you added the |
@danlsgiga Yay! That's awesome. Thanks for verifying! If you use a Caddyfile with:
in it, you can get the resulting JSON with:
and then you will see how TLS is enabled with the insecure option 😣 |
Yeah, I know... sometimes we don't have an option but to not verify upstreams certs (self signed). So, I did what you asked and:
That might not be supported yet :/ |
@danlsgiga I edited my comment a minute after I posted it :) The correct syntax is documented here: https://caddyserver.com/docs/caddyfile/directives/reverse_proxy |
Ha! it works!!!!!
One gotcha though: the json |
@danlsgiga That's a JSON option, not a Caddyfile option (the Caddyfile adapter sets that implicitly so that SNI works with the upstream.) https://caddyserver.com/docs/json/apps/http/servers/routes/handle/reverse_proxy/transport/http/tls/ |
np... works fine for me! Thanks a lot! |
This change allows you to specify the
"lookup_srv"
field on a proxy upstream to lookup a name's SRV records to get the upstream dial address. Resolves #3179.In the Caddyfile, prefix proxy upstream addresses with
srv+
, for example:or
(It's a little weird but that's how it goes I guess.)
@danlsgiga Can you please try this? Once the CI is finished, it should have a binary you can download and use, or you can just pull it yourself and build. Let me know!