Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
cc46b819
Commit
cc46b819
authored
Dec 05, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(rendering): fixed server side rendering issue when sertting enforce_domain to true, fixes #6769
parent
a9c0f66c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
pkg/cmd/grafana-server/web.go
+5
-4
pkg/middleware/validate_host.go
+6
-1
No files found.
pkg/cmd/grafana-server/web.go
View file @
cc46b819
...
...
@@ -46,14 +46,15 @@ func newMacaron() *macaron.Macaron {
Delims
:
macaron
.
Delims
{
Left
:
"[["
,
Right
:
"]]"
},
}))
if
setting
.
EnforceDomain
{
m
.
Use
(
middleware
.
ValidateHostHeader
(
setting
.
Domain
))
}
m
.
Use
(
middleware
.
GetContextHandler
())
m
.
Use
(
middleware
.
Sessioner
(
&
setting
.
SessionOptions
))
m
.
Use
(
middleware
.
RequestMetrics
())
// needs to be after context handler
if
setting
.
EnforceDomain
{
m
.
Use
(
middleware
.
ValidateHostHeader
(
setting
.
Domain
))
}
return
m
}
...
...
pkg/middleware/validate_host.go
View file @
cc46b819
...
...
@@ -8,7 +8,12 @@ import (
)
func
ValidateHostHeader
(
domain
string
)
macaron
.
Handler
{
return
func
(
c
*
macaron
.
Context
)
{
return
func
(
c
*
Context
)
{
// ignore local render calls
if
c
.
IsRenderCall
{
return
}
h
:=
c
.
Req
.
Host
if
i
:=
strings
.
Index
(
h
,
":"
);
i
>=
0
{
h
=
h
[
:
i
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment