fix: trust proxy forwarded headers so login works behind Caddy

Behind Jambotron's Caddy the app saw http while the browser used https,
so same-domain requests looked cross-origin and @CrossOrigin answered
403 on /api/auth/signin. server.forward-headers-strategy=framework makes
the app use X-Forwarded-Proto/Host; app.origin can be set via APP_ORIGIN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-17 22:29:31 +02:00
co-authored by Claude Opus 5.5
parent b28f2a8b9c
commit 7f2c1ec282
2 changed files with 14 additions and 2 deletions
+7 -1
View File
@@ -24,4 +24,10 @@ app:
# Совпадает со сроком жизни cookie (24 ч), иначе UI считает пользователя вошедшим, а API отвечает 401
jwtExpirationMs: 86400000
jwtCookieName: demo-decoupled
origin: http://localhost:4200
# Разрешённый origin для запросов с другого домена (dev-сервер Angular). UI через nginx фронта CORS не касается
origin: ${APP_ORIGIN:http://localhost:4200}
# За обратным прокси (nginx фронта, Caddy Jambotron) приложение видит http. Без X-Forwarded-Proto/Host
# запросы со своего https-домена выглядят кросс-доменными, и CORS отвечает на них 403
server:
forward-headers-strategy: framework