xoxys.nginx/templates/etc/nginx/conf.d/header.conf.j2
Robert Kaussow 30e3b7859e
Some checks failed
continuous-integration/drone/push Build is failing
cleanup
2019-07-18 08:59:41 +02:00

30 lines
1.3 KiB
Django/Jinja

#jinja2: lstrip_blocks: True
{{ ansible_managed | comment }}
# protect against protocol downgrading and cookie hijacking
# https://www.owasp.org/index.php/OWASP_Secure_Headers_Project#hsts
{% if nginx_tls_hsts_enabled and nginx_hsts_options is defined%}
add_header Strict-Transport-Security "{{ nginx_hsts_options | join('; ') }}";
{% endif %}
# improve the protection against Clickjacking
# https://www.owasp.org/index.php/OWASP_Secure_Headers_Project#xfo
{% if nginx_xfo_enabled %}
add_header X-Frame-Options {{ nginx_xfo_policy }};
{% endif %}
{% if nginx_csp_enabled and nginx_csp_options is defined %}
add_header Content-Security-Policy "{% for item in nginx_csp_options %}{{ item.directive }} {{ item.parameters | join(' ') }};{% endfor %}";
{% endif %}
# prevent from interpreting files as something else than declared by the content type in HTTP headers
# https://www.owasp.org/index.php/OWASP_Secure_Headers_Project#xcto
{% if nginx_xcto_enabled %}
add_header X-Content-Type-Options nosniff;
{% endif %}
# enables the cross-site scripting (XSS) filter of the browsers
# https://www.owasp.org/index.php/OWASP_Secure_Headers_Project#xxxsp
{% if nginx_xxxsp_enabled %}
add_header X-XSS-Protection "1; {{ nginx_xxxsp_parameters | default([])|join(' ; ') }}";
{% endif %}