1111}
1212```
1313
14- Running ` curl -IL https://example.com/ ` will yield additional headers:
14+ Running ` curl -IL https://example.com/ ` will yield the added security headers:
1515
1616<pre >
1717HTTP/1.1 200 OK
@@ -22,31 +22,23 @@ Vary: Accept-Encoding
2222Accept-Ranges: bytes
2323Connection: keep-alive
2424<b >X-Frame-Options: SAMEORIGIN
25+ X-Content-Type-Options: nosniff
2526X-XSS-Protection: 1; mode=block
2627Referrer-Policy: strict-origin-when-cross-origin
2728Strict-Transport-Security: max-age=63072000; includeSubDomains; preload</b >
2829</pre >
2930
30- Running ` curl -IL https://example.com/some.css ` (or ` some.js ` ) will yield * additional* security header:
31-
32- <pre >
33- HTTP/1.1 200 OK
34- ...
35- <b >X-Content-Type-Options: nosniff</b >
36- </pre >
37-
3831In general, the module features sending security HTTP headers in a way that better conforms to the standards.
3932For instance, ` Strict-Transport-Security ` header should * not* be sent for plain HTTP requests.
4033The module follows this recommendation.
4134
4235## Key Features
4336
4437* Plug-n-Play: the default set of security headers can be enabled with ` security_headers on; ` in your NGINX configuration
45- * Sends ` X-Content-Type-Options ` only for relevant MIME types (CSS/JS), preserving unnecessary headers from being sent for HTML documents
46- * Similarly, sends HTML-only security headers for relevant types only, not sending for others, e.g. ` X-Frame-Options ` is useless for CSS
38+ * Sends HTML-only security headers for relevant types only, not sending for others, e.g. ` X-Frame-Options ` is useless for CSS
4739* Plays well with conditional ` GET ` requests: the security headers are not included there unnecessarily
4840* Does not suffer the ` add_header ` directive's pitfalls
49- * Hides ` X-Powered-By ` , which often leaks PHP version information
41+ * Hides ` X-Powered-By ` and other headers which often leak software version information
5042* Hides ` Server ` header altogether, not just the version information
5143
5244## Configuration directives
@@ -62,7 +54,7 @@ Enables or disables applying security headers. The default set includes:
6254* ` X-Frame-Options: SAMEORIGIN `
6355* ` X-XSS-Protection: 1; mode=block `
6456* ` Referrer-Policy: strict-origin-when-cross-origin `
65- * ` X-Content-Type-Options: nosniff ` (for CSS and Javascript)
57+ * ` X-Content-Type-Options: nosniff `
6658
6759The values of these headers (or their inclusion) can be controlled with other ` security_headers_* ` directives below.
6860
@@ -84,7 +76,7 @@ It's worth noting that some of those headers bear functional use, e.g. [`X-Page-
8476> ... it is used to prevent infinite loops and unnecessary rewrites when PageSpeed
8577> fetches resources from an origin that also uses PageSpeed
8678
87- So it's best to specify ` hide_server_tokens on; ` in a front-facing NGINX insances , e.g.
79+ So it's best to specify ` hide_server_tokens on; ` in a front-facing NGINX instances , e.g.
8880the one being accessed by actual browsers, and not the ones consumed by Varnish or other software.
8981
9082In most cases you will be just fine with ` security_headers on; ` and ` hide_server_tokens on; ` , without any adjustments.
@@ -122,23 +114,15 @@ Special `omit` value will disable sending the header by the module.
122114Controls inclusion and value of [ ` Referrer-Policy ` ] ( https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy ) header.
123115Special ` omit ` value will disable sending the header by the module.
124116
125- ### ` security_headers_nosniff_types `
126-
127- - ** syntax** : ` security_headers_nosniff_types <mime_type> [..] `
128- - ** default** : ` text/css text/javascript application/javascript `
129- - ** context** : ` http ` , ` server ` , ` location `
130-
131- Defines MIME types, for which ` X-Content-Type-Options: nosniff ` is sent.
132-
133117## Install
134118
135- ### CentOS/RHEL 6, 7, 8
119+ ### CentOS/RHEL 6, 7, 8 or Amazon Linux 2
136120
137- It's easy to install the module in your stable nginx instance dynamically:
121+ It's easy to install the module in your stable NGINX instance dynamically:
138122
139123``` bash
140124sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm
141- sudo yum install nginx-module-security-headers
125+ sudo yum -y install nginx-module-security-headers
142126```
143127
144128Then add it at the top of your ` nginx.conf ` :
0 commit comments