Skip to content

dev: run keycloak with --proxy-headers xforwarded (fix cross-site OIDC cookies)#6

Merged
aatchison merged 1 commit into
mainfrom
fix/dev-proxy-headers-xforwarded
Jun 27, 2026
Merged

dev: run keycloak with --proxy-headers xforwarded (fix cross-site OIDC cookies)#6
aatchison merged 1 commit into
mainfrom
fix/dev-proxy-headers-xforwarded

Conversation

@aatchison

Copy link
Copy Markdown
Contributor

The image entrypoint scripts/entry-keycloak.sh hardcodes kc.sh start --http-enabled=true --proxy-headers forwarded. That CLI flag overrides KC_PROXY_HEADERS=xforwarded and makes keycloak expect the RFC 7239 Forwarded header — but the Tailscale ingress only sends X-Forwarded-*, so keycloak ignored the forwarded scheme, resolved the request as a non-secure context, and dropped the cross-site OIDC AUTH_SESSION_ID cookie → cookie_not_found / invalid_code on the thunderbird-accounts login (confirmed: keycloak events logged the pod IP, not the client IP — X-Forwarded-* not honored).

This overrides the dev keycloak start command to use --proxy-headers xforwarded (faithfully replicating the entrypoint: background start + apply-mfa-config.sh). Validated on dev next.

Proper long-term fix: make entry-keycloak.sh honor KC_PROXY_HEADERS (default forwarded so ECS is unchanged; EKS sets xforwarded) — an image change in thunderbird-accounts. Part of thunderbird/platform-infrastructure#599.

…C cookies)

The image entrypoint (entry-keycloak.sh) hardcodes 'kc.sh start --proxy-headers
forwarded', a CLI flag that overrides KC_PROXY_HEADERS=xforwarded and expects the
RFC 7239 Forwarded header. The Tailscale ingress only sends X-Forwarded-* headers,
so keycloak ignored the forwarded scheme -> 'Non-secure context' -> cross-site OIDC
cookies (AUTH_SESSION_ID) dropped -> cookie_not_found / invalid_code on the
thunderbird-accounts login. Override the dev entrypoint to use --proxy-headers
xforwarded (replicating the start + MFA reconcile). Proper fix: make
entry-keycloak.sh honor KC_PROXY_HEADERS in the image (thunderbird-accounts).

Part of thunderbird/platform-infrastructure#599

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@aatchison aatchison merged commit af22c08 into main Jun 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant