Skip to content

Instantly share code, notes, and snippets.

@maximebories
Created December 18, 2022 22:08
Show Gist options
  • Save maximebories/961f12101af369804d40d5ec287e562b to your computer and use it in GitHub Desktop.
Save maximebories/961f12101af369804d40d5ec287e562b to your computer and use it in GitHub Desktop.
Github-Page Basic Security
# Create the _headers file
echo "Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'" > _headers
echo "Strict-Transport-Security: max-age=31536000" >> _headers
echo "X-Content-Type-Options: nosniff" >> _headers
echo "X-Frame-Options: SAMEORIGIN" >> _headers
echo "X-XSS-Protection: 1; mode=block" >> _headers
# Add the _headers file to the repository and commit the changes
git add _headers
git commit -m "Add security headers"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment