diff --git a/CHANGELOG.md b/CHANGELOG.md index ae0e94521b6..3028057f2e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ * [BUGFIX] An index optimisation actually slows things down when using caching. Moved it to the right location. #2973 * [BUGFIX] Ingester: If push request contained both valid and invalid samples, valid samples were ingested but not stored to WAL of the chunks storage. This has been fixed. #3067 * [BUGFIX] Ruler: Config API would return both the `record` and `alert` in `YAML` response keys even when one of them must be empty. #3120 +* [BUGFIX] Index page now uses configured HTTP path prefix when creating links. #3126 ## 1.3.0 / 2020-08-21 diff --git a/pkg/api/api.go b/pkg/api/api.go index 876b6fa8c9a..799fd1fd982 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -166,9 +166,9 @@ func (a *API) RegisterAlertmanager(am *alertmanager.MultitenantAlertmanager, tar } // RegisterAPI registers the standard endpoints associated with a running Cortex. -func (a *API) RegisterAPI(cfg interface{}) { +func (a *API) RegisterAPI(httpPathPrefix string, cfg interface{}) { a.RegisterRoute("/config", configHandler(cfg), false) - a.RegisterRoute("/", http.HandlerFunc(indexHandler), false) + a.RegisterRoute("/", indexHandler(httpPathPrefix), false) } // RegisterDistributor registers the endpoints associated with the distributor. diff --git a/pkg/api/handlers.go b/pkg/api/handlers.go index ffbcad8e6b4..5fc097291f8 100644 --- a/pkg/api/handlers.go +++ b/pkg/api/handlers.go @@ -1,7 +1,9 @@ package api import ( + "html/template" "net/http" + "path" "github.com/go-kit/kit/log/level" "gopkg.in/yaml.v2" @@ -10,7 +12,7 @@ import ( ) // TODO: Update this content to be a template that is dynamic based on how Cortex is run. -const indexPageContent = ` +var indexPageContent = template.Must(template.New("main").Parse(`
@@ -21,29 +23,39 @@ const indexPageContent = `Admin Endpoints:
Dangerous:
-` +