Security help › Websites and servers
Add security settings (headers) to your website
A step-by-step guide for Website owners, with fixes for common problems.
Steps
- Nginx: inside your server block add: add_header Strict-Transport-Security "max-age=31536000" always; add_header X-Content-Type-Options nosniff always; add_header X-Frame-Options DENY always; add_header Referrer-Policy strict-origin-when-cross-origin always;
- Apache: Header always set Strict-Transport-Security "max-age=31536000" (and the same for the others, with Header always set).
- Cloudflare: Rules → Transform Rules → Modify Response Header, add each one.
- Content-Security-Policy needs care (it can break a site): start with Content-Security-Policy-Report-Only and tighten it once nothing breaks.
- Reload the web server (sudo nginx -t && sudo systemctl reload nginx).
What you should see
The free outside check says "All the main security settings are on".
Common problems
- My site broke after adding CSP Remove the CSP line, then add it back in Report-Only mode and allow what it reports.