diff --git a/selfservice/strategy/saml/strategy/strategy_login.go b/selfservice/strategy/saml/strategy/strategy_login.go index e18020686d55..9e589cc6c158 100644 --- a/selfservice/strategy/saml/strategy/strategy_login.go +++ b/selfservice/strategy/saml/strategy/strategy_login.go @@ -3,6 +3,7 @@ package strategy import ( "bytes" "encoding/json" + "github.com/ory/x/urlx" "net/http" "time" @@ -117,10 +118,12 @@ func (s *Strategy) Login(w http.ResponseWriter, r *http.Request, f *login.Flow, } if x.IsJSONRequest(r) { - s.d.Writer().WriteError(w, r, flow.NewBrowserLocationChangeRequiredError(handler.RouteSamlLoginInit)) + s.d.Writer().WriteError(w, r, flow.NewBrowserLocationChangeRequiredError(urlx.AppendPaths(s.d.Config().SelfPublicURL(r.Context()), + handler.RouteSamlLoginInit).String())) } else { - - http.Redirect(w, r, handler.RouteSamlLoginInit, http.StatusSeeOther) + http.Redirect(w, r, + urlx.AppendPaths(s.d.Config().SelfPublicURL(r.Context()), handler.RouteSamlLoginInit).String(), + http.StatusSeeOther) } return nil, errors.WithStack(flow.ErrCompletedByStrategy)