Dns server to use

1. Caddy version (caddy version):

v2.4.5

2. How I run Caddy:

caddy is run from the bash terminal

a. System environment:

centos

b. Command:

./caddy2 run --config t.json

c. Service/unit/compose file:

d. My complete Caddyfile or JSON config:

n/a

3. The problem I’m having:

How can one change where caddy sends dns requests for lookup_srv?

4. Error messages and/or full log output:

n/a

5. What I already tried:

6. Links to relevant resources:

You can configure the resolvers on the http transport

Thanks for the info. Can you provide an example how you’d configure that?

Well, resolvers just takes addresses which is an array of DNS servers to use for resolving. Not sure there’s really much in terms of examples to give. Just give it your DNS server’s IP address :man_shrugging:

I guess I’m not figuring out where it goes in the json?

                                {
                                "handler": "reverse_proxy",
                                "transport":{
                                    "http":{
                                         "resolver":{
                                            "addresses":["8.8.8.8","1.1.1.1"]
                                         }
                                    }
                                },
                                "upstreams": [
                                        {"lookup_srv":"_http._tcp.{http.request.host}"}
                                ],

The transport looks like this:

                  "transport": {
                    "protocol": "http",
                    "resolver": {
                      "addresses": []
                    }
                  },

A proxy can only have one transport, so it’s an object with the key "protocol" which specifies which one it is.

How do I debug this when it’s not working? I see a “dial” error:

making dial info: lookup _http._tcp.madeupcompany.com on 172.26.0.2:53: no such host

172.26.0.2 is an internal IP only so I’m not sure how it decided to use that for lookup?

I’ve tried “addresses” as “udp/8.8.8.8:53”

I guess you’re running into this issue:

Sorry, forgot that this still hadn’t been resolved :slightly_frowning_face: none of the core Caddy team use SRV, so it hasn’t been something we can test or put priority on.

Ok if you can direct me to where the code lives I will take a shot at fixing this

2 Likes

Sure, it’s in caddy/modules/caddyhttp/reverseproxy at master · caddyserver/caddy · GitHub, the issue mentions in broad strokes where the problem is, I suggested a solution in lookup_srv resolvers configuration is still using systems resolv.conf · Issue #3801 · caddyserver/caddy · GitHub which requires a bit of a refactor.

2 Likes

One last thing, any docs on how to make changes to caddy for inclusion?

This topic was automatically closed after 30 days. New replies are no longer allowed.