outposts/proxy: copy user-agent header from upstream request

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-12-02 10:01:54 +01:00
parent e917e756cc
commit e42ad8db93
1 changed files with 2 additions and 0 deletions

View File

@ -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