diff --git a/command/agent/http.go b/command/agent/http.go index 6bdd1916f6..c70527446b 100644 --- a/command/agent/http.go +++ b/command/agent/http.go @@ -52,6 +52,8 @@ func (s *HTTPServer) Shutdown() { // registerHandlers is used to attach our handlers to the mux func (s *HTTPServer) registerHandlers() { + s.mux.HandleFunc("/", s.Index) + s.mux.HandleFunc("/v1/status/leader", s.wrap(s.StatusLeader)) s.mux.HandleFunc("/v1/status/peers", s.wrap(s.StatusPeers)) @@ -96,6 +98,15 @@ func (s *HTTPServer) wrap(handler func(resp http.ResponseWriter, req *http.Reque return f } +// Renders a simple index page +func (s *HTTPServer) Index(resp http.ResponseWriter, req *http.Request) { + if req.URL.Path == "/" { + resp.Write([]byte("Consul Agent")) + } else { + resp.WriteHeader(404) + } +} + // decodeBody is used to decode a JSON request body func decodeBody(req *http.Request, out interface{}) error { dec := json.NewDecoder(req.Body)