From 3cd74cef9cb34f4fa3bdbe16a0e234e275e1c555 Mon Sep 17 00:00:00 2001 From: Steven Clark Date: Thu, 8 Feb 2024 16:33:53 -0500 Subject: [PATCH] Forward EST .well-known requests on performance replicas (#25304) - CE fix for properly forwarding the EST .well-known requests to performance replicas internally instead of redirecting through http headers --- http/handler.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/http/handler.go b/http/handler.go index 847f5eb133..a58b4ec8ab 100644 --- a/http/handler.go +++ b/http/handler.go @@ -415,10 +415,13 @@ func wrapGenericHandler(core *vault.Core, h http.Handler, props *vault.HandlerPr case strings.HasPrefix(r.URL.Path, "/ui"), r.URL.Path == "/robots.txt", r.URL.Path == "/": // RFC 5785 case strings.HasPrefix(r.URL.Path, "/.well-known/"): + perfStandby := core.PerfStandby() standby, err := core.Standby() if err != nil { core.Logger().Warn("error resolving standby status handling .well-known path", "error", err) - } else if standby { + } else if standby && !perfStandby { + // Standby nodes, not performance standbys, don't start plugins + // so registration can not happen, instead redirect to active respondStandby(core, w, r.URL) cancelFunc() return @@ -429,6 +432,8 @@ func wrapGenericHandler(core *vault.Core, h http.Handler, props *vault.HandlerPr } else { if redir != "" { newReq := r.Clone(ctx) + // Save the original path for audit logging. + newReq.RequestURI = newReq.URL.Path newReq.URL.Path = redir hf(w, newReq) cancelFunc()