Skip to content

Commit a999c4d

Browse files
committed
Fix htmx redirect
1 parent 52a2faa commit a999c4d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/server/saml.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,11 @@ func (s *SAMLManager) login(w http.ResponseWriter, r *http.Request, providerName
477477
http.Error(w, "auth url err: "+err.Error(), http.StatusInternalServerError)
478478
return
479479
}
480-
http.Redirect(w, r, url, http.StatusFound)
480+
if r.Header.Get("HX-Request") == "true" {
481+
w.Header().Set("HX-Redirect", url)
482+
} else {
483+
http.Redirect(w, r, url, http.StatusFound)
484+
}
481485
}
482486

483487
func (s *SAMLManager) acs(w http.ResponseWriter, r *http.Request) {

0 commit comments

Comments
 (0)