mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-28 04:10:44 -04:00
serve robots.txt from the root when the UI is enabled (#5686)
This commit is contained in:
parent
35328c50e7
commit
849de30d5f
1 changed files with 2 additions and 1 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue