mirror of
https://github.com/prometheus/alertmanager
synced 2025-02-16 18:47:10 +00:00
Merge pull request #42 from prometheus/handle-index-only-from-root
Only serve alerts page from /alerts or /.
This commit is contained in:
commit
438e8b98b8
11
web/web.go
11
web/web.go
@ -46,7 +46,16 @@ func (w WebService) ServeForever() error {
|
|||||||
http.Error(w, "", 404)
|
http.Error(w, "", 404)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
http.Handle("/", prometheus.InstrumentHandler("index", w.AlertsHandler))
|
http.HandleFunc("/", prometheus.InstrumentHandlerFunc("index", func(rw http.ResponseWriter, req *http.Request) {
|
||||||
|
// The "/" pattern matches everything, so we need to check
|
||||||
|
// that we're at the root here.
|
||||||
|
if req.URL.Path != "/" {
|
||||||
|
http.NotFound(rw, req)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
w.AlertsHandler.ServeHTTP(rw, req)
|
||||||
|
}))
|
||||||
|
|
||||||
http.Handle("/alerts", prometheus.InstrumentHandler("alerts", w.AlertsHandler))
|
http.Handle("/alerts", prometheus.InstrumentHandler("alerts", w.AlertsHandler))
|
||||||
http.Handle("/silences", prometheus.InstrumentHandler("silences", w.SilencesHandler))
|
http.Handle("/silences", prometheus.InstrumentHandler("silences", w.SilencesHandler))
|
||||||
http.Handle("/status", prometheus.InstrumentHandler("status", w.StatusHandler))
|
http.Handle("/status", prometheus.InstrumentHandler("status", w.StatusHandler))
|
||||||
|
Loading…
Reference in New Issue
Block a user