send index.html if auth didnt succeed as well
This commit is contained in:
parent
ca0ddaa076
commit
403549ed26
4
auth.go
4
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) {
|
subtle.ConstantTimeCompare([]byte(req.Host), []byte(hidden_domain)) != 1) {
|
||||||
http.Error(wr, BAD_REQ_MSG, http.StatusBadRequest)
|
http.Error(wr, BAD_REQ_MSG, http.StatusBadRequest)
|
||||||
} else {
|
} 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("Proxy-Authenticate", `Basic realm="dumbproxy"`)
|
||||||
wr.Header().Set("Content-Length", strconv.Itoa(len([]byte(AUTH_REQUIRED_MSG))))
|
wr.Header().Set("Content-Length", strconv.Itoa(len([]byte(AUTH_REQUIRED_MSG))))
|
||||||
wr.WriteHeader(407)
|
wr.WriteHeader(407)
|
||||||
|
|
Loading…
Reference in New Issue