@@ -79,20 +79,39 @@ http {
7979 include /usr/local/openresty/nginx/conf/upload_size*.conf;
8080 include /usr/local/openresty/nginx/conf/nginx_http_extras*.conf;
8181
82+ # config to not allow the browser to render the page inside an frame or iframe
83+ # and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking
84+ add_header X-Frame-Options SAMEORIGIN;
85+
86+ # when serving user-supplied content, include a X-Content-Type-Options: nosniff header along with the Content-Type: header,
87+ # to disable content-type sniffing on some browsers.
88+ # https://www.owasp.org/index.php/List_of_useful_HTTP_headers
89+ add_header X-Content-Type-Options nosniff;
90+
91+ # This header enables the Cross-site scripting (XSS) filter built into most recent web browsers.
92+ # It's usually enabled by default anyway, so the role of this header is to re-enable the filter for
93+ # this particular website if it was disabled by the user.
94+ # https://www.owasp.org/index.php/List_of_useful_HTTP_headers
95+ add_header X-XSS-Protection "1; mode=block" ;
96+
97+ # config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
98+ # to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping
99+ add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;" ;
100+
82101 # Accept underscores in headers as NAXSI does this
83102 underscores_in_headers on;
84103
85104 server {
86105 include /usr/local/openresty/nginx/conf/nginx_statsd_metrics.conf;
87106 include /usr/local/openresty/nginx/conf/response_body.conf;
88107 # Optionally listen to proxy protocol:
89- include /usr/local/openresty/nginx/conf/nginx_listen.conf ;
108+ include /usr/local/openresty/nginx/conf/nginx_listen.conf;
90109
91110 # These should be volume added:
92111 include /usr/local/openresty/nginx/conf/server_certs.conf;
93112
94113 # Optionally include client cert config:
95- include /usr/local/openresty/nginx/conf/client_certs*.conf ;
114+ include /usr/local/openresty/nginx/conf/client_certs*.conf;
96115
97116 # Set the correct host name from the request header...
98117 server_name $host ;
@@ -101,7 +120,7 @@ http {
101120
102121 set_by_lua_file $https_port_string lua/get_env.lua 'HTTPS_REDIRECT_PORT_STRING' ;
103122 # Will redirect requests not on https if HTTPS_REDIRECT=TRUE (the default)
104- include /usr/local/openresty/nginx/conf/ssl_redirect.conf ;
123+ include /usr/local/openresty/nginx/conf/ssl_redirect.conf ;
105124
106125 include /usr/local/openresty/nginx/conf/nginx_server_extras*.conf ;
107126
@@ -147,7 +166,7 @@ http {
147166 access_log off;
148167 allow 127.0.0.1 ;
149168 deny all;
150- }
169+ }
151170 }
152171}
153172events {
0 commit comments