Skip to content

Commit bf02dd7

Browse files
committed
Fix #19
1 parent 269d6a1 commit bf02dd7

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Accept-Ranges: bytes
2525
Connection: keep-alive
2626
<b>X-Frame-Options: SAMEORIGIN
2727
X-Content-Type-Options: nosniff
28-
X-XSS-Protection: 1; mode=block
28+
X-XSS-Protection: 0
2929
Referrer-Policy: strict-origin-when-cross-origin
3030
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload</b>
3131
</pre>
@@ -70,7 +70,7 @@ start NGINX with the module to avoid having your domain preloaded by Chrome.
7070
Enables or disables applying security headers. The default set includes:
7171

7272
* `X-Frame-Options: SAMEORIGIN`
73-
* `X-XSS-Protection: 1; mode=block`
73+
* `X-XSS-Protection: 0`
7474
* `Referrer-Policy: strict-origin-when-cross-origin`
7575
* `X-Content-Type-Options: nosniff`
7676

@@ -105,12 +105,15 @@ A special value `omit` disables sending a particular header by the module (usefu
105105
### `security_headers_xss`
106106

107107
- **syntax**: `security_headers_xss off | on | block | omit`
108-
- **default**: `block`
108+
- **default**: `off`
109109
- **context**: `http`, `server`, `location`
110110

111111
Controls `X-XSS-Protection` header.
112112
Special `omit` value will disable sending the header by the module.
113113
The `off` value is for disabling XSS protection: `X-XSS-Protection: 0`.
114+
This is the default because
115+
[modern browsers do not support it](https://github.com/GetPageSpeed/ngx_security_headers/issues/19) and where it is
116+
supported, it introduces vulnerabilities.
114117

115118
### `security_headers_frame`
116119

src/ngx_http_security_headers_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ ngx_http_security_headers_merge_loc_conf(ngx_conf_t *cf, void *parent,
366366
}
367367

368368
ngx_conf_merge_uint_value(conf->xss, prev->xss,
369-
NGX_HTTP_XSS_HEADER_BLOCK);
369+
NGX_HTTP_XSS_HEADER_OFF);
370370
ngx_conf_merge_uint_value(conf->fo, prev->fo,
371371
NGX_HTTP_FO_HEADER_SAME);
372372
ngx_conf_merge_uint_value(conf->rp, prev->rp,

t/headers.t

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ hello world
3535
content-type: text/plain; charset=utf-8
3636
x-content-type-options: nosniff
3737
x-frame-options: SAMEORIGIN
38-
x-xss-protection: 1; mode=block
38+
x-xss-protection: 0
3939
4040
4141
@@ -116,7 +116,7 @@ hello world
116116
--- response_headers
117117
x-content-type-options: nosniff
118118
x-frame-options: SAMEORIGIN
119-
x-xss-protection: 1; mode=block
119+
x-xss-protection: 0
120120
referrer-policy: unsafe-url
121121
122122
@@ -141,7 +141,7 @@ hello world
141141
--- response_headers
142142
x-content-type-options: nosniff
143143
x-frame-options: SAMEORIGIN
144-
x-xss-protection: 1; mode=block
144+
x-xss-protection: 0
145145
referrer-policy: origin
146146
147147
=== TEST 8: X-Frame-Options should not be sent for CSS (even when encoding specified)
@@ -159,4 +159,4 @@ referrer-policy: origin
159159
hello world
160160
--- response_headers
161161
content-type: text/css; charset=utf-8
162-
!x-frame-options
162+
!x-frame-options

0 commit comments

Comments
 (0)