MM-11241: fix context site url header (#9079)
* fix context's SiteURLHeader to use the subpath This fixes various commands such as /open and /groupmsg, as well as OAuth related redirects. * MM-11246: also leverage GetSiteHeader() in completeSaml
Этот коммит содержится в:
коммит произвёл
Carlos Tadeu Panato Junior
родитель
dccd95bc67
Коммит
7c08ff9986
@@ -68,7 +68,9 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c.SetSiteURLHeader(app.GetProtocol(r) + "://" + r.Host)
|
subpath, _ := utils.GetSubpathFromConfig(c.App.Config())
|
||||||
|
siteURLHeader := app.GetProtocol(r) + "://" + r.Host + subpath
|
||||||
|
c.SetSiteURLHeader(siteURLHeader)
|
||||||
|
|
||||||
w.Header().Set(model.HEADER_REQUEST_ID, c.RequestId)
|
w.Header().Set(model.HEADER_REQUEST_ID, c.RequestId)
|
||||||
w.Header().Set(model.HEADER_VERSION_ID, fmt.Sprintf("%v.%v.%v.%v", model.CurrentVersion, model.BuildNumber, c.App.ClientConfigHash(), c.App.License() != nil))
|
w.Header().Set(model.HEADER_VERSION_ID, fmt.Sprintf("%v.%v.%v.%v", model.CurrentVersion, model.BuildNumber, c.App.ClientConfigHash(), c.App.License() != nil))
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost-server/app"
|
|
||||||
"github.com/mattermost/mattermost-server/mlog"
|
"github.com/mattermost/mattermost-server/mlog"
|
||||||
"github.com/mattermost/mattermost-server/model"
|
"github.com/mattermost/mattermost-server/model"
|
||||||
)
|
)
|
||||||
@@ -143,7 +142,7 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
if action == model.OAUTH_ACTION_MOBILE {
|
if action == model.OAUTH_ACTION_MOBILE {
|
||||||
ReturnStatusOK(w)
|
ReturnStatusOK(w)
|
||||||
} else {
|
} else {
|
||||||
http.Redirect(w, r, app.GetProtocol(r)+"://"+r.Host, http.StatusFound)
|
http.Redirect(w, r, c.GetSiteURLHeader(), http.StatusFound)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user