Hi Andrew,

On 9/16/19 11:03 AM,  wrote:
> I have the url as /dns-query in my addDOHLocal config, and in the case
> that users put the domain name in to their browser address bar I'm
> wanting to redirect request to / to my help page.
> ie:
>   https://doh.mydomain.com/dns-query - for DoH lookups
>   https://doh.mydomain.com/ - redirect to another URL
> I'm thinking I need to use newDOHResponseMapEntry for  this, but I'm
> unsure how to add this to my config.
> This is what I'm trying (and failing with):
>  supportpage = newDOHResponseMapEntry("/", 302,
> "https://support.mydoman.com";)
>  setResponsesMap(supportpage)

First, 'setResponsesMap' is not a standalone function but needs to be
applied to a DoH frontend, which is created with addDoHLocal().
It also takes a list of response map entries, not a single entry. Be
careful that newDOHResponseMapEntry() does take a regular expression, so
if you only want to match '/' you should write something like '^/$' instead.
So you need to do something like this:

supportpagemap = { newDOHResponseMapEntry("^/$", 302,
"https://support.mydoman.com";) }
dohFE = getDOHFrontend(0)

It will only apply the map to the first DoH frontend (based on the '0'
index), so if you have more than one you'll have to carefully apply it
to all of them.

Best regards,
Remi Gacogne
PowerDNS.COM BV - https://www.powerdns.com/

Attachment: signature.asc
Description: OpenPGP digital signature

dnsdist mailing list

Reply via email to