Skip to content

Commit f15ac87

Browse files
committed
Add security-related HTTP headers to static web site and web-app.
Adds the following headers to the static website content and the web-app responses (but doesn't modify any of the headers for API responses): - X-XSS-Protection - X-Frame-Options - X-Content-Type-Options
1 parent baa4ab6 commit f15ac87

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

templates/etc/nginx/router.conf.mustache

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,12 @@ http {
207207
server_name _;
208208

209209
root {{static_site.build_dir}};
210+
211+
# Security headers
212+
# https://www.owasp.org/index.php/OWASP_Secure_Headers_Project#tab=Headers
213+
more_set_headers "X-XSS-Protection: 1; mode=block";
214+
more_set_headers "X-Frame-Options: DENY";
215+
more_set_headers "X-Content-Type-Options: nosniff";
210216
}
211217

212218
map $http_accept_encoding $normalized_accept_encoding {
@@ -266,6 +272,12 @@ http {
266272
set $x_api_umbrella_request_id $http_x_api_umbrella_request_id;
267273
root {{web.dir}}/public;
268274

275+
# Security headers
276+
# https://www.owasp.org/index.php/OWASP_Secure_Headers_Project#tab=Headers
277+
more_set_headers "X-XSS-Protection: 1; mode=block";
278+
more_set_headers "X-Frame-Options: DENY";
279+
more_set_headers "X-Content-Type-Options: nosniff";
280+
269281
{{^_development_env?}}
270282
location /web-assets/ {
271283
alias {{_embedded_root_dir}}/apps/core/current/build/dist/web-app-assets/web-assets/;

0 commit comments

Comments
 (0)