From cd291556fc95bce0678fe7f3ad3d64430a8452f8 Mon Sep 17 00:00:00 2001 From: yusing Date: Sat, 10 May 2025 21:25:27 +0800 Subject: [PATCH] fix(oid); redirect --- internal/auth/oidc.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/auth/oidc.go b/internal/auth/oidc.go index 18e0648..66cf741 100644 --- a/internal/auth/oidc.go +++ b/internal/auth/oidc.go @@ -139,8 +139,12 @@ func (auth *OIDCProvider) getIdToken(ctx context.Context, oauthToken *oauth2.Tok } func (auth *OIDCProvider) HandleAuth(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "" { + r.URL.Path = OIDCAuthInitPath + } if r.TLS == nil && r.Header.Get("X-Forwarded-Proto") != "https" { - http.Redirect(w, r, "https://"+requestHost(r)+OIDCAuthInitPath, http.StatusFound) + r.URL.Scheme = "https" + http.Redirect(w, r, r.URL.String(), http.StatusFound) return } switch r.URL.Path {