Add realm to Proxy-Authenticate with probe resist (#58)

In #53 we added a realm to the Proxy-Authenticate header, but the realm
only is added, when `probe_resistance` is off.
With this change, Proxy-Authenticate header will have a realm
when `probe_resistance` is on as well.
This commit is contained in:
sergeyfrolov 2019-05-29 12:25:55 -06:00 committed by GitHub
parent 7af135a175
commit 694cbc9ec0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -212,7 +212,7 @@ func serveHiddenPage(w http.ResponseWriter, authErr error) (int, error) {
w.Header().Set("Content-Type", "text/html")
if authErr != nil {
w.Header().Set("Proxy-Authenticate", "Basic")
w.Header().Set("Proxy-Authenticate", "Basic realm=\"Caddy Secure Web Proxy\"")
w.WriteHeader(http.StatusProxyAuthRequired)
w.Write([]byte(fmt.Sprintf(hiddenPage, AuthFail)))
return 0, authErr