diff --git a/internal/server/oidc/handler.go b/internal/server/oidc/handler.go index 6ff65ee..36f4a59 100644 --- a/internal/server/oidc/handler.go +++ b/internal/server/oidc/handler.go @@ -23,6 +23,7 @@ type OIDCHandler struct { oidc *oidcservice.OIDCService user *userservice.UserService uiHost string + prod bool } func NewOIDCHandler(cfg *config.Config, oidc *oidcservice.OIDCService, user *userservice.UserService) *OIDCHandler { @@ -32,6 +33,7 @@ func NewOIDCHandler(cfg *config.Config, oidc *oidcservice.OIDCService, user *use oidc: oidc, user: user, uiHost: uiHost, + prod: cfg.Prod, } } @@ -126,5 +128,11 @@ func (h *OIDCHandler) Callback(w http.ResponseWriter, r *http.Request) { Host: h.uiHost, Path: "/", } - http.Redirect(w, r, uiURL.String(), http.StatusFound) + + redirectURL := "/" + if !h.prod { + redirectURL = uiURL.String() + } + + http.Redirect(w, r, redirectURL, http.StatusFound) }