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
6cac7c2d
Commit
6cac7c2d
authored
Mar 14, 2018
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renderer: avoid redirect render requests
closes #11180
parent
da190007
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletions
+9
-1
pkg/components/renderer/renderer.go
+3
-1
pkg/middleware/dashboard_redirect.go
+6
-0
No files found.
pkg/components/renderer/renderer.go
View file @
6cac7c2d
...
...
@@ -72,7 +72,9 @@ func RenderToPng(params *RenderOpts) (string, error) {
localDomain
=
setting
.
HttpAddr
}
url
:=
fmt
.
Sprintf
(
"%s://%s:%s/%s"
,
setting
.
Protocol
,
localDomain
,
setting
.
HttpPort
,
params
.
Path
)
// &render=1 signals to the legacy redirect layer to
// avoid redirect these requests.
url
:=
fmt
.
Sprintf
(
"%s://%s:%s/%s&render=1"
,
setting
.
Protocol
,
localDomain
,
setting
.
HttpPort
,
params
.
Path
)
binPath
,
_
:=
filepath
.
Abs
(
filepath
.
Join
(
setting
.
PhantomDir
,
executable
))
scriptPath
,
_
:=
filepath
.
Abs
(
filepath
.
Join
(
setting
.
PhantomDir
,
"render.js"
))
...
...
pkg/middleware/dashboard_redirect.go
View file @
6cac7c2d
...
...
@@ -6,6 +6,7 @@ import (
"github.com/grafana/grafana/pkg/bus"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
"gopkg.in/macaron.v1"
)
...
...
@@ -36,9 +37,14 @@ func RedirectFromLegacyDashboardUrl() macaron.Handler {
func
RedirectFromLegacyDashboardSoloUrl
()
macaron
.
Handler
{
return
func
(
c
*
m
.
ReqContext
)
{
slug
:=
c
.
Params
(
"slug"
)
renderRequest
:=
c
.
QueryBool
(
"render"
)
if
slug
!=
""
{
if
url
,
err
:=
getDashboardUrlBySlug
(
c
.
OrgId
,
slug
);
err
==
nil
{
if
renderRequest
&&
strings
.
Contains
(
url
,
setting
.
AppSubUrl
)
{
url
=
strings
.
Replace
(
url
,
setting
.
AppSubUrl
,
""
,
1
)
}
url
=
strings
.
Replace
(
url
,
"/d/"
,
"/d-solo/"
,
1
)
url
=
fmt
.
Sprintf
(
"%s?%s"
,
url
,
c
.
Req
.
URL
.
RawQuery
)
c
.
Redirect
(
url
,
301
)
...
...
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