Free tool
Get the security headers your website is missing
Pick your host and what your site uses. Copy the exact settings. Everything is built in your browser; nothing is sent.
vercel.json
The root folder of your project (next to package.json). If you already have a vercel.json, add only the "headers" part to it.
{
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "Strict-Transport-Security",
"value": "max-age=31536000"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Referrer-Policy",
"value": "strict-origin-when-cross-origin"
},
{
"key": "Permissions-Policy",
"value": "camera=(), microphone=(), geolocation=(), payment=(), usb=()"
},
{
"key": "Content-Security-Policy-Report-Only",
"value": "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'; object-src 'none'"
},
{
"key": "X-Frame-Options",
"value": "DENY"
}
]
}
]
}
- Strict-Transport-Security only works on a site that already serves HTTPS correctly. Turn it on only when every page loads over HTTPS.
- The policy is in report-only mode: it protects nothing yet. Browse your site with the browser console open, fix or allow what it reports, then switch to enforce.
- Deploy again. Vercel applies these to every route.
What each header does
Strict-Transport-Security: Tells browsers to use only HTTPS for your site for a year, which blocks downgrade attacks.X-Content-Type-Options: Stops browsers guessing file types, so an uploaded file cannot be run as a script.Referrer-Policy: Sends other sites only your domain, not the full page address.Permissions-Policy: Blocks browser features your site does not use (camera, microphone, location, payments, USB) even if a script on the page asks.Content-Security-Policy-Report-Only: The same policy in test mode: the browser reports what it would block (see the browser console) but blocks nothing.X-Frame-Options: Stops other sites embedding yours in a frame (clickjacking).
What it does not do
It writes settings; it cannot apply them or test your live site. Start with the Content Security Policy in report-only mode and watch for breakage before enforcing it. The policy is a sensible starting point, not one tailored to every site: if you use services not on the list, add them by hand.
Want this checked every week? PixelPrivate scans your site and tells you when a setting goes missing.
Check your business security free
No credit card. Results in about 30 seconds.
Run Free Security Check