fix(web-app-keycloak): host-only oauth2-proxy cookies over .onion

Emit cookie_domains only when a clearnet domain exists; onion-only deployments then fall back to host-only session/CSRF cookies, so the oauth2-proxy CSRF check works over .onion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 4.8 committed 2026-07-08 09:28:57 +02:00
1 parent e191b91de0
commit cc9e60599c
1 file changed
+3 -1
@@ -7,7 +7,9 @@ upstreams = "http://{{ lookup('sso', sso_proxy_application_id, '
{% set _has_onion = _tor_node != '' and (_app_domains | select('search', _tor_node) | list | length > 0) %}
{% set _clearnet_domains = _app_domains | reject('search', '\.onion$') | list %}
{% set _has_clearnet = _clearnet_domains | length > 0 %}
cookie_domains = [{% if _has_clearnet %}"{{ _clearnet_domains | common_dns_suffix }}", {% endif %}{% if _has_onion %}".{{ _tor_node }}", {% endif %}"{{ lookup('domain', 'web-app-keycloak') }}"]
{% if _has_clearnet %}
cookie_domains = ["{{ _clearnet_domains | common_dns_suffix }}", "{{ lookup('domain', 'web-app-keycloak') }}"]
{% endif %}
whitelist_domains = [{% if _has_clearnet %}".{{ DOMAIN_PRIMARY }}"{% endif %}{% if _has_clearnet and _has_onion %}, {% endif %}{% if _has_onion %}".{{ _tor_node }}"{% endif %}]
# keycloak provider