HTTP security headers are one of the fastest, highest-impact upgrades you can make to protect any website against Cross-Site Scripting (XSS), clickjacking, MIME-sniffing, and HTTPS downgrade attacks. You can test your own domain in seconds with our free BPLTS Security Headers Checker.
The 6 Essential HTTP Security Headers (Grade A+)
1. Strict-Transport-Security (HSTS)
Tells browsers to always connect to your site over encrypted HTTPS and blocks SSL-stripping downgrade attacks.
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
2. Content-Security-Policy (CSP)
Whitelists trusted origins for scripts, styles, images, media, and frames so malicious injected scripts cannot run.
Content-Security-Policy: default-src 'self' https: data: blob: 'unsafe-inline'; frame-ancestors 'self'; upgrade-insecure-requests;
3. X-Frame-Options
Prevents attackers from loading your site inside a hidden iframe on another domain (clickjacking protection).
X-Frame-Options: SAMEORIGIN
4. X-Content-Type-Options
Prevents browsers from guessing (MIME-sniffing) file types away from the declared Content-Type header.
X-Content-Type-Options: nosniff
5. Referrer-Policy
Controls how much URL referrer data is sent when a visitor clicks a link from your website to another domain.
Referrer-Policy: strict-origin-when-cross-origin
6. Permissions-Policy
Explicitly controls which browser hardware APIs (camera, microphone, geolocation, payment) are allowed on your origin and embedded iframes.
Permissions-Policy: camera=(self), microphone=(self), geolocation=(), payment=()
Upcoming Cross-Origin Isolation Headers
- Cross-Origin-Embedder-Policy (COEP): Ensures cross-origin assets explicitly grant permission via CORS or CORP before loading.
- Cross-Origin-Opener-Policy (COOP): Isolates top-level browsing contexts from cross-origin popups.
- Cross-Origin-Resource-Policy (CORP): Lets servers specify which origins are allowed to embed their assets.
Quick Copy-Paste Fix for Nginx
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
add_header Content-Security-Policy "default-src 'self' https: data: blob: 'unsafe-inline'; frame-ancestors 'self'; upgrade-insecure-requests;" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(self), microphone=(self), geolocation=(), payment=()" always;
After saving your Nginx config, run nginx -t && systemctl reload nginx and re-scan your site in the HTTP Security Headers Checker to confirm your Grade A+ report.
