proxy: fix unauthorized redirect loop (fwdauth) (#448)

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
Bobby DeSimone 2020-01-11 10:23:50 -08:00 committed by GitHub
parent 8b7f344e01
commit f0d811f2bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 53 deletions

View file

@ -73,6 +73,9 @@ func (p *Proxy) traefikCallback(w http.ResponseWriter, r *http.Request) error {
// provider. If the user is unauthorized, a `401` error is returned.
func (p *Proxy) Verify(verifyOnly bool) http.Handler {
return httputil.HandlerFunc(func(w http.ResponseWriter, r *http.Request) error {
if status := r.FormValue("auth_status"); status == fmt.Sprint(http.StatusForbidden) {
return httputil.NewError(http.StatusForbidden, errors.New(http.StatusText(http.StatusForbidden)))
}
uri, err := urlutil.ParseAndValidateURL(r.FormValue("uri"))
if err != nil {
return httputil.NewError(http.StatusBadRequest, err)