mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-10-10 18:58:10 +02:00
Stop forcing Access-Control-Allow-Origin to $scheme://$host. This default broke Element (element.infinito.nexus) -> Synapse (matrix.infinito.nexus) CORS and blocked login. Now ACAO is only set when 'aca_origin' is provided; otherwise we defer to the upstream app (e.g., Synapse) to emit correct CORS headers. Also convert top comments to Jinja block comment. Discussion & debugging details: https://chatgpt.com/share/68de2236-4aec-800f-adc5-d025922c8753
24 lines
798 B
Django/Jinja
24 lines
798 B
Django/Jinja
{# Configure CORS headers dynamically based on role variables.
|
|
If no variable is defined, defaults are applied (e.g. same-origin).
|
|
Discussion: https://chat.openai.com/share/2671b961-c1b0-472d-bae2-2804d0455e8a #}
|
|
|
|
{# Access-Control-Allow-Origin #}
|
|
{% if aca_origin is defined %}
|
|
add_header 'Access-Control-Allow-Origin' {{ aca_origin }};
|
|
{% endif %}
|
|
|
|
{# Access-Control-Allow-Credentials #}
|
|
{% if aca_credentials is defined %}
|
|
add_header 'Access-Control-Allow-Credentials' {{ aca_credentials }};
|
|
{% endif %}
|
|
|
|
{# Access-Control-Allow-Methods #}
|
|
{% if aca_methods is defined %}
|
|
add_header 'Access-Control-Allow-Methods' {{ aca_methods }};
|
|
{% endif %}
|
|
|
|
{# Access-Control-Allow-Headers #}
|
|
{% if aca_headers is defined %}
|
|
add_header 'Access-Control-Allow-Headers' {{ aca_headers }};
|
|
{% endif %}
|