Force X-Frame-Options SAMEORIGIN for Nagios (closes #17)

pull/22/head
Emilien Mantel 2016-03-15 15:46:49 +01:00
parent 96e406c791
commit 9a5afd09fa
2 changed files with 16 additions and 0 deletions

View File

@ -60,11 +60,13 @@ server {
{{ htpasswd(item.htpasswd, 1) }} {{ htpasswd(item.htpasswd, 1) }}
{% endif %} {% endif %}
{% block template_headers %}
# --> Custom headers # --> Custom headers
{% for key, value in __headers.iteritems() %} {% for key, value in __headers.iteritems() %}
add_header {{ key }} {{ value | replace(' always', '') }}{% if nginx_version.stdout | version_compare('1.7.5', 'ge') and ' always' in value %} always{% endif %}; add_header {{ key }} {{ value | replace(' always', '') }}{% if nginx_version.stdout | version_compare('1.7.5', 'ge') and ' always' in value %} always{% endif %};
{% endfor %} {% endfor %}
# <-- Custom headers # <-- Custom headers
{% endblock %}
{% if not __location.has_key('/') %} {% if not __location.has_key('/') %}
location / { location / {

View File

@ -11,6 +11,20 @@
index index.php index.html; index index.php index.html;
{% endblock %} {% endblock %}
{% block template_headers %}
# --> Custom headers
{% for key, value in __headers.iteritems() %}
{% if key == "X-Frame-Options" %}
# X-Frame-Options forced by Ansible
add_header {{ key }} SAMEORIGIN{% if nginx_version.stdout | version_compare('1.7.5', 'ge') %} always{% endif %};
{% else %}
add_header {{ key }} {{ value | replace(' always', '') }}{% if nginx_version.stdout | version_compare('1.7.5', 'ge') and ' always' in value %} always{% endif %};
{% endif %}
{% endfor %}
# <-- Custom headers
{% endblock %}
{% block template_local_content %} {% block template_local_content %}
location ~ /\.ht { location ~ /\.ht {
deny all; deny all;