Skip to content

Commit

Permalink
Add security-related HTTP headers to static web site and web-app.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
GUI committed Dec 15, 2016
1 parent baa4ab6 commit f15ac87
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions templates/etc/nginx/router.conf.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ http {
server_name _;

root {{static_site.build_dir}};

# Security headers
# https://www.owasp.org/index.php/OWASP_Secure_Headers_Project#tab=Headers
more_set_headers "X-XSS-Protection: 1; mode=block";
more_set_headers "X-Frame-Options: DENY";
more_set_headers "X-Content-Type-Options: nosniff";
}

map $http_accept_encoding $normalized_accept_encoding {
Expand Down Expand Up @@ -266,6 +272,12 @@ http {
set $x_api_umbrella_request_id $http_x_api_umbrella_request_id;
root {{web.dir}}/public;

# Security headers
# https://www.owasp.org/index.php/OWASP_Secure_Headers_Project#tab=Headers
more_set_headers "X-XSS-Protection: 1; mode=block";
more_set_headers "X-Frame-Options: DENY";
more_set_headers "X-Content-Type-Options: nosniff";

{{^_development_env?}}
location /web-assets/ {
alias {{_embedded_root_dir}}/apps/core/current/build/dist/web-app-assets/web-assets/;
Expand Down

0 comments on commit f15ac87

Please sign in to comment.