Skip to content

Instantly share code, notes, and snippets.

@thelovekesh
Created May 21, 2021 15:31
Show Gist options
  • Select an option

  • Save thelovekesh/38f15d839806213bc384432b1dd8e8a4 to your computer and use it in GitHub Desktop.

Select an option

Save thelovekesh/38f15d839806213bc384432b1dd8e8a4 to your computer and use it in GitHub Desktop.
Best HTTP security headers for Nginx
# Include these headers in /etc/nginx/sites-available/example.com.conf file
# security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment