From d55b31dd8251d495021dea2ce2efd43666c9a30e Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 19 Jul 2021 17:11:11 +0200 Subject: [PATCH] outposts/proxy: set server header Signed-off-by: Jens Langhammer --- internal/outpost/proxy/proxy.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/outpost/proxy/proxy.go b/internal/outpost/proxy/proxy.go index 2d7092ba9..12c139d6f 100644 --- a/internal/outpost/proxy/proxy.go +++ b/internal/outpost/proxy/proxy.go @@ -238,6 +238,7 @@ func (p *OAuthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) { if req.URL.Path != p.AuthOnlyPath && strings.HasPrefix(req.URL.Path, p.ProxyPrefix) { prepareNoCache(rw) } + rw.Header().Set("Server", "authentik-outpost") switch path := req.URL.Path; { case path == p.RobotsPath: @@ -410,6 +411,8 @@ func (p *OAuthProxy) getAuthenticatedSession(rw http.ResponseWriter, req *http.R // addHeadersForProxying adds the appropriate headers the request / response for proxying func (p *OAuthProxy) addHeadersForProxying(rw http.ResponseWriter, req *http.Request, session *sessionsapi.SessionState) { + // req is the request that is forwarded to the upstream server + // rw is the response writer that goes back to the client req.Header["X-Forwarded-User"] = []string{session.User} if session.Email != "" { req.Header["X-Forwarded-Email"] = []string{session.Email}