This commit is contained in:
Andrew Azores 2026-03-04 09:53:54 +08:00 committed by GitHub
commit a7ef934910
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -634,6 +634,10 @@ func (p *OAuthProxy) isTrustedIP(req *http.Request) bool {
// SignInPage writes the sign in template to the response
func (p *OAuthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code int) {
prepareNoCache(rw)
rw.Header().Set("WWW-Authenticate", "Bearer")
if p.basicAuthValidator != nil {
rw.Header().Add("WWW-Authenticate", "Basic")
}
rw.WriteHeader(code)
redirectURL, err := p.appDirector.GetRedirect(req)
@ -1039,7 +1043,7 @@ func (p *OAuthProxy) Proxy(rw http.ResponseWriter, req *http.Request) {
// the user did not explicitly start the login flow
p.doOAuthStart(rw, req, nil)
} else {
p.SignInPage(rw, req, http.StatusForbidden)
p.SignInPage(rw, req, http.StatusUnauthorized)
}
case ErrAccessDenied: