Skip to content

Instantly share code, notes, and snippets.

@1c7
Created September 14, 2018 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1c7/f42b155581d4be0d158d9017e8b6509c to your computer and use it in GitHub Desktop.
Save 1c7/f42b155581d4be0d158d9017e8b6509c to your computer and use it in GitHub Desktop.
Nginx Safety Checklist
# For Safety
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header Content-Security-Policy "default-src https: data: 'unsafe-inline' 'unsafe-eval'" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Xss-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
server_tokens off;
add_header Referrer-Policy "no-referrer-when-downgrade";
add_header Feature-Policy "midi none;notifications none;push none;sync-xhr none;microphone none;camera none;magnetometer none;gyroscope none;speaker self;vibrate none;fullscreen self;payment none;";
# Sources:
# https://scotthelme.co.uk/hardening-your-http-response-headers/#x-frame-options
# https://fearby.com/article/set-up-feature-policy-referrer-policy-and-content-security-policy-headers-in-nginx/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment