mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 04:12:09 +08:00
Backend: Remove more globals (#29644)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@ -8,7 +8,7 @@ import (
|
||||
"gopkg.in/macaron.v1"
|
||||
)
|
||||
|
||||
func ValidateHostHeader(domain string) macaron.Handler {
|
||||
func ValidateHostHeader(cfg *setting.Cfg) macaron.Handler {
|
||||
return func(c *models.ReqContext) {
|
||||
// ignore local render calls
|
||||
if c.IsRenderCall {
|
||||
@ -20,8 +20,8 @@ func ValidateHostHeader(domain string) macaron.Handler {
|
||||
h = h[:i]
|
||||
}
|
||||
|
||||
if !strings.EqualFold(h, domain) {
|
||||
c.Redirect(strings.TrimSuffix(setting.AppUrl, "/")+c.Req.RequestURI, 301)
|
||||
if !strings.EqualFold(h, cfg.Domain) {
|
||||
c.Redirect(strings.TrimSuffix(cfg.AppURL, "/")+c.Req.RequestURI, 301)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user