Search code examples
curldnslibcurldns-over-https

Does curl --doh-url not accept ip address for dns servers and is the response just html?


When running the curl --doh-url https://dns-server.example.com https://www.example.com command, does curl --doh-url not take in an ip address? Can you not specify https://127.0.0.1 or something along the lines of an ip address? Trying to do this with libcurl code as well, but would like to specify the frontend ip address of a gcp load balancer. Also is the response of a curl --doh-url command just html text? I only see the doh dns response when I have the -v verbose flag on. Was wondering if there was another flag that just shows the dns response. Many thanks!


Solution

    1. Sure you can specify the DoH URL with an IP address. It requires that your DoH server has that IP in its certificate's subjectaltname though. (There's currently no --doh-insecure option to let you skip the cert check for DoH, possibly worked on in this pull request).

    2. No, a response of a curl --doh-url command is not just html text - that rather sounds like your server returns something bad That command line option just controls how curl resolves the name used in the URL and curl will then transfer the URL just as normal. If the DoH lookup fails, it will of course not transfer any URL though.