fix(auth): set cookie Domain to .homelab.local for subdomain coverage

Without the leading dot, the auth_token cookie was only sent to the
exact host homelab.local — not to finance.homelab.local, auth.homelab.local,
etc. — so the forward-auth check failed on any subdomain after login.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gonçalo Rodrigues 2026-06-20 16:43:33 +01:00
parent 464bde2ee6
commit dcb573ed8a

View File

@ -300,7 +300,7 @@ func (h *Handler) LoginAPI(w http.ResponseWriter, r *http.Request) {
Name: "auth_token",
Value: token,
Path: "/",
Domain: "homelab.local",
Domain: ".homelab.local",
HttpOnly: true,
SameSite: http.SameSiteLaxMode,
})
@ -343,7 +343,7 @@ func (h *Handler) Login(w http.ResponseWriter, r *http.Request) {
Name: "auth_token",
Value: token,
Path: "/",
Domain: "homelab.local",
Domain: ".homelab.local",
HttpOnly: true,
SameSite: http.SameSiteLaxMode,
})
@ -364,7 +364,7 @@ func (h *Handler) Logout(w http.ResponseWriter, r *http.Request) {
Name: "auth_token",
Value: "",
Path: "/",
Domain: "homelab.local",
Domain: ".homelab.local",
MaxAge: -1,
HttpOnly: true,
SameSite: http.SameSiteLaxMode,