From 7e7cd1ee908de574bc358f38677fd8866720e971 Mon Sep 17 00:00:00 2001 From: Star Brilliant Date: Mon, 2 Jul 2018 17:55:58 +0800 Subject: [PATCH] Workaround a bug causing Firefox 61-62 to reject responses with Content-Type = application/dns-message --- doh-server/ietf.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doh-server/ietf.go b/doh-server/ietf.go index 5aaedf8..a53fa30 100644 --- a/doh-server/ietf.go +++ b/doh-server/ietf.go @@ -192,6 +192,8 @@ func (s *Server) patchDNSCryptProxyReqID(w http.ResponseWriter, r *http.Request, // Workaround a bug causing Firefox 61-62 to reject responses with Content-Type = application/dns-message func (s *Server) patchFirefoxContentType(w http.ResponseWriter, r *http.Request) bool { if strings.Contains(r.UserAgent(), "Firefox") && strings.Contains(r.Header.Get("Accept"), "application/dns-udpwireformat") && !strings.Contains(r.Header.Get("Accept"), "application/dns-message") { + log.Println("Firefox 61-62 detected. Patching response.") + w.Header().Set("Vary", "Accept, User-Agent") w.Header().Set("Content-Type", "application/dns-udpwireformat") return true }