Print something useful when browsing the local DoH URL

This commit is contained in:
Frank Denis 2019-11-28 23:30:54 +01:00
parent 3ef9ec8732
commit 5d6f9358c9
1 changed files with 2 additions and 1 deletions

View File

@ -18,8 +18,9 @@ func (handler localDoHHandler) ServeHTTP(writer http.ResponseWriter, request *ht
dataType := "application/dns-message"
writer.Header().Set("Server", "dnscrypt-proxy")
if request.Header.Get("Content-Type") != dataType {
writer.Header().Set("Content-Type", "text/plain")
writer.WriteHeader(400)
writer.Write([]byte("Unexpected Content-Type\n"))
writer.Write([]byte("dnscrypt-proxy local DoH server\n"))
return
}
proxy := handler.proxy