From 849de30d5fa142e6b8c404fad04130f504dcb6fc Mon Sep 17 00:00:00 2001 From: Matthew Irish Date: Mon, 5 Nov 2018 15:48:46 -0600 Subject: [PATCH] serve robots.txt from the root when the UI is enabled (#5686) --- http/handler.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/http/handler.go b/http/handler.go index 0a8429d0de..d236457a0d 100644 --- a/http/handler.go +++ b/http/handler.go @@ -123,6 +123,7 @@ func Handler(props *vault.HandlerProperties) http.Handler { if core.UIEnabled() == true { if uiBuiltIn { mux.Handle("/ui/", http.StripPrefix("/ui/", gziphandler.GzipHandler(handleUIHeaders(core, handleUI(http.FileServer(&UIAssetWrapper{FileSystem: assetFS()})))))) + mux.Handle("/robots.txt", gziphandler.GzipHandler(handleUIHeaders(core, handleUI(http.FileServer(&UIAssetWrapper{FileSystem: assetFS()}))))) } else { mux.Handle("/ui/", handleUIHeaders(core, handleUIStub())) } @@ -182,7 +183,7 @@ func wrapGenericHandler(core *vault.Core, h http.Handler, maxRequestSize int64, } r = newR - case strings.HasPrefix(r.URL.Path, "/ui"), r.URL.Path == "/": + case strings.HasPrefix(r.URL.Path, "/ui"), r.URL.Path == "/robots.txt", r.URL.Path == "/": default: respondError(w, http.StatusNotFound, nil) cancelFunc()