Pull request: dnsforward: don't redirect doh queries

Merge in DNS/adguard-home from 2628-no-redirect to master

Updates #2628.

Squashed commit of the following:

commit 686f3254bed1c84fe79aa203c1da4db243f301e3
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Feb 2 13:51:16 2021 +0300

    dnsforward: don't redirect doh queries
This commit is contained in:
Ainar Garipov 2021-02-02 14:15:13 +03:00
parent f5c47b6193
commit 28b9abf1dd

View file

@ -529,5 +529,13 @@ func (s *Server) registerHandlers() {
s.conf.HTTPRegister(http.MethodGet, "/control/access/list", s.handleAccessList)
s.conf.HTTPRegister(http.MethodPost, "/control/access/set", s.handleAccessSet)
// Register both versions, with and without the trailing slash, to
// prevent a 301 Moved Permanently redirect when clients request the
// path without the trailing slash. Those redirects break some clients.
//
// See go doc net/http.ServeMux.
//
// See also https://github.com/AdguardTeam/AdGuardHome/issues/2628.
s.conf.HTTPRegister("", "/dns-query", s.handleDOH)
s.conf.HTTPRegister("", "/dns-query/", s.handleDOH)
}