Skip to content

Commit 548f703

Browse files
author
Pierre Buyle
committed
Support for the X-Frame-Origin response header.
1 parent abc42d7 commit 548f703

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ The following variables are available to configure the role:
7474
servers, defaults to ```["unix:/var/run/php-fpm-bkp.sock"]```.
7575
- **nginx_drupal_language_path_prefixes**: (optional) The list of enabled
7676
language path prefixes used on the site.
77+
- **nginx_drupal_x_frame_options**: (optional) Value of the X-Frame-Options
78+
response header, defaults to `DENY`. If the site uses frames, set to
79+
`SAMEORIGIN`. `DENY` may conflicts with pseudo streaming (at least with Nginx
80+
version 1.0.12)
7781
- **nginx_drupal_sites**: The list of available sites.
7882
Each site uses the following structure:
7983
- **file_name**: The name of the site configuration file.

defaults/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ nginx_drupal_upstream_backup_servers: ["unix:/var/run/php-fpm-bkp.sock"]
2929
nginx_drupal_sites: none
3030
nginx_drupal_http_pre_includes: []
3131
nginx_drupal_http_post_includes: []
32-
nginx_drupal_language_path_prefixes: []
32+
nginx_drupal_language_path_prefixes: []
33+
nginx_drupal_x_frame_options: DENY

templates/nginx.j2

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,13 @@ http {
160160
## https://www.owasp.org/index.php/List_of_useful_HTTP_headers.
161161
add_header X-XSS-Protection '1; mode=block';
162162

163+
{% if nginx_drupal_x_frame_options %}
163164
## Enable clickjacking protection in modern browsers. Available in
164165
## IE8 also. See
165166
## https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header
166167
## This may conflicts with pseudo streaming (at least with Nginx version 1.0.12).
167-
## Uncomment the line below if you're not using media streaming.
168-
## For sites being framing on the same domqin uncomment the line below.
169-
#add_header X-Frame-Options SAMEORIGIN;
170-
## For sites accepting to be framed in any context comment the
171-
## line below.
172-
add_header X-Frame-Options DENY;
168+
add_header X-Frame-Options {{ nginx_drupal_x_frame_options }};
169+
{% endif %}
173170

174171
## Block MIME type sniffing on IE.
175172
add_header X-Content-Options nosniff;

0 commit comments

Comments
 (0)