From d0ceafe79eb47bf933050cf504206491bf71c125 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 1 Dec 2021 20:41:55 +0100 Subject: [PATCH] outposts/proxy: add X-authentik-meta-version Signed-off-by: Jens Langhammer --- Dockerfile | 1 - internal/outpost/proxyv2/application/mode_common.go | 3 +++ internal/web/static.go | 1 + website/docs/providers/proxy/proxy.md | 4 ++++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cb1a3f55e..f06df4d4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,6 @@ COPY --from=website-builder /work/website/help/ /work/website/help/ COPY ./cmd /work/cmd COPY ./web/static.go /work/web/static.go -COPY ./website/static.go /work/website/static.go COPY ./internal /work/internal COPY ./go.mod /work/go.mod COPY ./go.sum /work/go.sum diff --git a/internal/outpost/proxyv2/application/mode_common.go b/internal/outpost/proxyv2/application/mode_common.go index e3ff6ad30..1b0e94199 100644 --- a/internal/outpost/proxyv2/application/mode_common.go +++ b/internal/outpost/proxyv2/application/mode_common.go @@ -5,6 +5,8 @@ import ( "fmt" "net/http" "strings" + + "goauthentik.io/internal/constants" ) func (a *Application) addHeaders(headers http.Header, c *Claims) { @@ -28,6 +30,7 @@ func (a *Application) addHeaders(headers http.Header, c *Claims) { headers.Set("X-authentik-meta-outpost", a.outpostName) headers.Set("X-authentik-meta-provider", a.proxyConfig.Name) headers.Set("X-authentik-meta-app", a.proxyConfig.AssignedApplicationSlug) + headers.Set("X-authentik-meta-version", constants.OutpostUserAgent()) userAttributes := c.Proxy.UserAttributes // Attempt to set basic auth based on user's attributes diff --git a/internal/web/static.go b/internal/web/static.go index 9b47b2d61..7e7cf6772 100644 --- a/internal/web/static.go +++ b/internal/web/static.go @@ -13,6 +13,7 @@ import ( func (ws *WebServer) configureStatic() { statRouter := ws.lh.NewRoute().Subrouter() + statRouter.Use(ws.staticHeaderMiddleware) indexLessRouter := statRouter.NewRoute().Subrouter() indexLessRouter.Use(web.DisableIndex) // Media files, always local diff --git a/website/docs/providers/proxy/proxy.md b/website/docs/providers/proxy/proxy.md index 8f4c94533..ffcf643f3 100644 --- a/website/docs/providers/proxy/proxy.md +++ b/website/docs/providers/proxy/proxy.md @@ -42,6 +42,10 @@ Besides these user-specific headers, some application specific headers are also The authentik application's slug. +- X-authentik-meta-version: `authentik-outpost@1.2.3 (build=tagged)` + + The authentik outpost's version. + # HTTPS The outpost listens on both 9000 for HTTP and 9443 for HTTPS.