mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
ServeFromSubPath: Redirect to URL with subpath when subpath missing (#66724)
* ServeFromSubPath: Redirect to URL with subpath when subpath missing * Review fixes * Added tests * Use constant * change to useMiddleware * Update pkg/middleware/subpath_redirect.go --------- Co-authored-by: Carl Bergquist <carl.bergquist@gmail.com>
This commit is contained in:
@@ -602,6 +602,7 @@ func (hs *HTTPServer) addMiddlewaresAndStaticRoutes() {
|
||||
|
||||
if hs.Cfg.ServeFromSubPath && hs.Cfg.AppSubURL != "" {
|
||||
m.SetURLPrefix(hs.Cfg.AppSubURL)
|
||||
m.UseMiddleware(middleware.SubPathRedirect(hs.Cfg))
|
||||
}
|
||||
|
||||
m.UseMiddleware(web.Renderer(filepath.Join(hs.Cfg.StaticRootPath, "views"), "[[", "]]"))
|
||||
@@ -616,6 +617,7 @@ func (hs *HTTPServer) addMiddlewaresAndStaticRoutes() {
|
||||
|
||||
m.UseMiddleware(hs.ContextHandler.Middleware)
|
||||
m.Use(middleware.OrgRedirect(hs.Cfg, hs.userService))
|
||||
|
||||
if !hs.Features.IsEnabled(featuremgmt.FlagAuthnService) {
|
||||
m.Use(accesscontrol.LoadPermissionsMiddleware(hs.accesscontrolService))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user