From 66eb35056429fcc7845ea6ca25cadf2e5e7598b2 Mon Sep 17 00:00:00 2001 From: cclohmar Date: Fri, 10 Jul 2026 13:19:45 +0100 Subject: [PATCH] fix: inject Bearer token in API proxy --- main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.go b/main.go index 9fd6962..5267d63 100644 --- a/main.go +++ b/main.go @@ -610,6 +610,11 @@ func initials(s string) string { func apiProxyHandler(w http.ResponseWriter, r *http.Request) { target, _ := url.Parse("http://127.0.0.1:8080") proxy := httputil.NewSingleHostReverseProxy(target) + // Inject Bearer token for authelia-api auth + token := os.Getenv("AUTHELIA_SECRET") + if token != "" { + r.Header.Set("Authorization", "Bearer "+token) + } r.URL.Path = strings.TrimPrefix(r.URL.Path, "/api") proxy.ServeHTTP(w, r) }