diff --git a/http/handler.go b/http/handler.go index 2d481d22f..60624e5e8 100644 --- a/http/handler.go +++ b/http/handler.go @@ -478,6 +478,15 @@ func NewStatikHandler(h *Handler) statikHandler { } func (s statikHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if strings.HasPrefix(r.UserAgent(), "curl") { + msg := "Welcome. Pilosa v" + s.handler.api.Version() + " is running. Visit https://www.pilosa.com/docs/ for more information." + if s.statikFS != nil { + msg += " Try the Web UI by visiting this URL in your browser." + } + http.Error(w, msg, http.StatusNotFound) + return + } + if s.statikFS == nil { msg := "Web UI is not available. Please run `make generate-statik` before building Pilosa with `make install`." s.handler.logger.Printf(msg) @@ -485,11 +494,6 @@ func (s statikHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - if strings.HasPrefix(r.UserAgent(), "curl") { - http.Error(w, "Welcome. Pilosa is running. Visit https://www.pilosa.com/docs/ for more information or try the Web UI by visiting this URL in your browser.", http.StatusNotFound) - return - } - // /vds is a front-end route, not a backend route. Without this check, refreshing at /vds // will request a nonexistent resource and return 404. if r.URL.String() == "/vds" {