From e42ad8db9312f512b0b80f3a4d5056200e1bddcc Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 2 Dec 2021 10:01:54 +0100 Subject: [PATCH] outposts/proxy: copy user-agent header from upstream request Signed-off-by: Jens Langhammer --- internal/outpost/proxyv2/application/mode_forward.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/outpost/proxyv2/application/mode_forward.go b/internal/outpost/proxyv2/application/mode_forward.go index 6a4a83193..889e115c2 100644 --- a/internal/outpost/proxyv2/application/mode_forward.go +++ b/internal/outpost/proxyv2/application/mode_forward.go @@ -27,6 +27,7 @@ func (a *Application) forwardHandleTraefik(rw http.ResponseWriter, r *http.Reque claims, err := a.getClaims(r) if claims != nil && err == nil { a.addHeaders(rw.Header(), claims) + rw.Header().Set("User-Agent", r.Header.Get("User-Agent")) a.log.WithField("headers", rw.Header()).Trace("headers written to forward_auth") return } else if claims == nil && a.IsAllowlisted(r) { @@ -70,6 +71,7 @@ func (a *Application) forwardHandleNginx(rw http.ResponseWriter, r *http.Request claims, err := a.getClaims(r) if claims != nil && err == nil { a.addHeaders(rw.Header(), claims) + rw.Header().Set("User-Agent", r.Header.Get("User-Agent")) rw.WriteHeader(200) a.log.WithField("headers", rw.Header()).Trace("headers written to forward_auth") return