summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorJesse Hallam <jesse.hallam@gmail.com>2018-07-11 04:13:37 -0400
committerCarlos Tadeu Panato Junior <ctadeu@gmail.com>2018-07-11 10:13:37 +0200
commit7c08ff99864721956d1496b8114fa54dd33569f0 (patch)
treec905cd1609ffe1422bee81743d225da0ef2abc92 /web
parentdccd95bc67779a5b83a2660aec0cf4622cd56550 (diff)
downloadchat-7c08ff99864721956d1496b8114fa54dd33569f0.tar.gz
chat-7c08ff99864721956d1496b8114fa54dd33569f0.tar.bz2
chat-7c08ff99864721956d1496b8114fa54dd33569f0.zip
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
Diffstat (limited to 'web')
-rw-r--r--web/handlers.go4
-rw-r--r--web/saml.go3
2 files changed, 4 insertions, 3 deletions
diff --git a/web/handlers.go b/web/handlers.go
index c089f460b..71a43bc48 100644
--- a/web/handlers.go
+++ b/web/handlers.go
@@ -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_VERSION_ID, fmt.Sprintf("%v.%v.%v.%v", model.CurrentVersion, model.BuildNumber, c.App.ClientConfigHash(), c.App.License() != nil))
diff --git a/web/saml.go b/web/saml.go
index f3e5a12e8..9cf93bdab 100644
--- a/web/saml.go
+++ b/web/saml.go
@@ -8,7 +8,6 @@ import (
"net/http"
"strings"
- "github.com/mattermost/mattermost-server/app"
"github.com/mattermost/mattermost-server/mlog"
"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 {
ReturnStatusOK(w)
} else {
- http.Redirect(w, r, app.GetProtocol(r)+"://"+r.Host, http.StatusFound)
+ http.Redirect(w, r, c.GetSiteURLHeader(), http.StatusFound)
}
}
}