org: fixed issue with orgId query param redirect handling when grafana is under subpath and reverse proxy, fixes #8089

This commit is contained in:
Torkel Ödegaard 2017-04-12 07:10:46 +02:00
parent d2bf2e86ed
commit b3df1aa9bd

View File

@ -1,11 +1,13 @@
package middleware
import (
"fmt"
"net/http"
"strconv"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
"gopkg.in/macaron.v1"
)
@ -39,6 +41,7 @@ func OrgRedirect() macaron.Handler {
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)
}
}