Commit b3df1aa9 by Torkel Ödegaard

org: fixed issue with orgId query param redirect handling when grafana is under…

org: fixed issue with orgId query param redirect handling when grafana is under subpath and reverse proxy, fixes #8089
parent d2bf2e86
package middleware package middleware
import ( import (
"fmt"
"net/http" "net/http"
"strconv" "strconv"
"github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
) )
...@@ -39,6 +41,7 @@ func OrgRedirect() macaron.Handler { ...@@ -39,6 +41,7 @@ func OrgRedirect() macaron.Handler {
return return
} }
c.Redirect(c.Req.URL.String(), 302) newUrl := setting.ToAbsUrl(fmt.Sprintf("%s?%s", c.Req.URL.Path, c.Req.URL.Query().Encode()))
c.Redirect(newUrl, 302)
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment