summaryrefslogtreecommitdiffstats
path: root/api/context.go
diff options
context:
space:
mode:
authornickago <ngonella@calpoly.edu>2015-08-25 11:06:11 -0700
committernickago <ngonella@calpoly.edu>2015-08-25 11:06:11 -0700
commit6ac39ef687238def1a7175e52bba67d388a70564 (patch)
tree14a1963f71b18efcb67d47c1f6f9567043240a33 /api/context.go
parent70da0dbec6ed35cfc3196d50db4209378549fd92 (diff)
downloadchat-6ac39ef687238def1a7175e52bba67d388a70564.tar.gz
chat-6ac39ef687238def1a7175e52bba67d388a70564.tar.bz2
chat-6ac39ef687238def1a7175e52bba67d388a70564.zip
Added a link to error page that returns users to the root page
Diffstat (limited to 'api/context.go')
-rw-r--r--api/context.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/api/context.go b/api/context.go
index 8babf85f2..aaf304e2c 100644
--- a/api/context.go
+++ b/api/context.go
@@ -4,14 +4,15 @@
package api
import (
- l4g "code.google.com/p/log4go"
- "github.com/mattermost/platform/model"
- "github.com/mattermost/platform/store"
- "github.com/mattermost/platform/utils"
"net"
"net/http"
"net/url"
"strings"
+
+ l4g "code.google.com/p/log4go"
+ "github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/store"
+ "github.com/mattermost/platform/utils"
)
var sessionCache *utils.Cache = utils.NewLru(model.SESSION_CACHE_SIZE)
@@ -431,10 +432,22 @@ func IsPrivateIpAddress(ipAddress string) bool {
}
func RenderWebError(err *model.AppError, w http.ResponseWriter, r *http.Request) {
+
+ protocol := "http"
+ if utils.Cfg.ServiceSettings.UseSSL {
+ forwardProto := r.Header.Get(model.HEADER_FORWARDED_PROTO)
+ if forwardProto != "http" {
+ protocol = "https"
+ }
+ }
+
+ SiteURL := protocol + "://" + r.Host
+
m := make(map[string]string)
m["Message"] = err.Message
m["Details"] = err.DetailedError
m["SiteName"] = utils.Cfg.ServiceSettings.SiteName
+ m["SiteURL"] = SiteURL
w.WriteHeader(err.StatusCode)
ServerTemplates.ExecuteTemplate(w, "error.html", m)