HTTP Server: Serve Grafana with a custom URL path prefix (#17048)
Adds a new [server] setting `serve_from_sub_path`. By enabling this setting and using a subpath in `root_url` setting, e.g. `root_url = http://localhost:3000/grafana`, Grafana will be accessible on `http://localhost:3000/grafana`. By default it is set to `false` for compatibility reasons. Closes #16623
This commit is contained in:
committed by
Marcus Efraimsson
parent
b547a0cb34
commit
04d473b3e5
+11
-6
@@ -47,10 +47,11 @@ var (
|
||||
|
||||
var (
|
||||
// App settings.
|
||||
Env = DEV
|
||||
AppUrl string
|
||||
AppSubUrl string
|
||||
InstanceName string
|
||||
Env = DEV
|
||||
AppUrl string
|
||||
AppSubUrl string
|
||||
ServeFromSubPath bool
|
||||
InstanceName string
|
||||
|
||||
// build
|
||||
BuildVersion string
|
||||
@@ -205,8 +206,9 @@ type Cfg struct {
|
||||
Logger log.Logger
|
||||
|
||||
// HTTP Server Settings
|
||||
AppUrl string
|
||||
AppSubUrl string
|
||||
AppUrl string
|
||||
AppSubUrl string
|
||||
ServeFromSubPath bool
|
||||
|
||||
// Paths
|
||||
ProvisioningPath string
|
||||
@@ -610,8 +612,11 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ServeFromSubPath = server.Key("serve_from_sub_path").MustBool(false)
|
||||
|
||||
cfg.AppUrl = AppUrl
|
||||
cfg.AppSubUrl = AppSubUrl
|
||||
cfg.ServeFromSubPath = ServeFromSubPath
|
||||
|
||||
Protocol = HTTP
|
||||
protocolStr, err := valueAsString(server, "protocol", "http")
|
||||
|
||||
Reference in New Issue
Block a user