Skip to content

Instantly share code, notes, and snippets.

@GhanshyamBhava
Created February 1, 2021 11:21
Show Gist options
  • Save GhanshyamBhava/9cab2dd75184aae813ac2e7ea9f48964 to your computer and use it in GitHub Desktop.
Save GhanshyamBhava/9cab2dd75184aae813ac2e7ea9f48964 to your computer and use it in GitHub Desktop.
htacces for better security setup for your website.
# Security header for website
Header set X-Permitted-Cross-Domain-Policies "none"
Header set X-Content-Type-Options "nosniff"
Header set X-XSS-Protection "1; mode=block"
Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
Header set X-Frame-Options "SAMEORIGIN"
Header set Feature-Policy "geolocation 'self'; vibrate 'none'"
Header set Expect-CT enforce,max-age=2592000
Header set Referrer-Policy "origin"
Header set Permissions-Policy "geolocation=();midi=();notifications=();push=();sync-xhr=();microphone=();camera=();magnetometer=();gyroscope=();speaker=(self);vibrate=();fullscreen=(self);payment=();"
# This will affect your website it won't allow you to access resources from cross site
Header set Content-Security-Policy "default-src 'none'; frame-ancestors 'none'; style-src 'none' img-src https://www.domain.com/;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment