From 403549ed26abb451ebfb3cbb12295ffe0c578a6b Mon Sep 17 00:00:00 2001 From: b1ek Date: Fri, 26 Jul 2024 16:58:46 +1000 Subject: [PATCH] send index.html if auth didnt succeed as well --- auth.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/auth.go b/auth.go index b88721d..f21c6a3 100644 --- a/auth.go +++ b/auth.go @@ -89,6 +89,10 @@ func requireBasicAuth(wr http.ResponseWriter, req *http.Request, hidden_domain s subtle.ConstantTimeCompare([]byte(req.Host), []byte(hidden_domain)) != 1) { http.Error(wr, BAD_REQ_MSG, http.StatusBadRequest) } else { + if req.Host == "astra.blek.codes" && req.URL.Host == "astra.blek.codes" && req.URL.Path == "/" { + SendIndex(wr, req) + return + } wr.Header().Set("Proxy-Authenticate", `Basic realm="dumbproxy"`) wr.Header().Set("Content-Length", strconv.Itoa(len([]byte(AUTH_REQUIRED_MSG)))) wr.WriteHeader(407)