Implementation help
Fixing the issues in your report
Practical fixes for the security and encryption findings Website Analyzer reports. Each one explains what it protects against, when it applies, a safe starting point, and how to confirm it worked.
A safe baseline to start from
These headers are low-risk for most sites and cover the majority of findings in a report. Add them first, confirm the site still works, then tighten individual policies.
Content-Security-Policy: default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; form-action 'self'
Strict-Transport-Security: max-age=31536000
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()
X-Frame-Options: DENYContent-Security-Policy
Limits where scripts, styles, images and frames may load from, which is the main defence against cross-site scripting. It is also the most likely header to break a working site, so start restrictive and add only what your pages actually need.
Safe starting policy
Content-Security-Policy:
default-src 'self';
base-uri 'self';
object-src 'none';
frame-ancestors 'none';
form-action 'self';
img-src 'self' data:;
style-src 'self';
script-src 'self'If something stops loading, add only the specific source it needs. Common additions:
Common compatibility additions
# Google Fonts
style-src 'self' https://fonts.googleapis.com;
font-src 'self' https://fonts.gstatic.com;
# Google Analytics / Tag Manager
script-src 'self' https://www.googletagmanager.com;
connect-src 'self' https://www.google-analytics.com;
# Images from a CDN or image host
img-src 'self' data: https://cdn.example.com;
# Embedded videos, maps or forms
frame-src https://www.youtube-nocookie.com;To see what a policy would block without breaking anything, ship it in report-only mode first and watch the browser console:
Test before enforcing
Content-Security-Policy-Report-Only: default-src 'self'; script-src 'self''unsafe-inline' for scripts. It makes the policy far easier to deploy, but it also removes most of the protection the policy was added for. Prefer moving inline scripts into files, or using nonces or hashes, and treat 'unsafe-inline' for scripts as a temporary compatibility step. For styles it is a much smaller risk.HTTPS enforcement (HSTS)
Tells browsers to use HTTPS for your domain and refuse to fall back to an insecure connection. Only apply it once every page, redirect and asset already works over HTTPS.
Recommended starting value (1 year)
Strict-Transport-Security: max-age=31536000Advanced — only when you are sure
Strict-Transport-Security: max-age=31536000; includeSubDomains; preloadClickjacking protection
Stops other sites from loading your pages inside an invisible frame and tricking visitors into clicking things.
Content-Security-Policy: frame-ancestors 'none'
X-Frame-Options: DENYframe-ancestors is the modern control and is what current browsers follow; X-Frame-Options is kept for older clients. If a partner legitimately embeds your pages, replace 'none' with their exact origin rather than removing the policy.
Referrer and permissions
Two small headers that reduce data leakage and limit what pages can ask the browser for.
Referrer-Policy
Referrer-Policy: strict-origin-when-cross-originSends the full address within your own site, but only the domain to other sites, so private URLs and query strings are not shared.
Permissions-Policy
Permissions-Policy: camera=(), microphone=(), geolocation=()Switches off browser features your site does not use. Remove an entry if a page genuinely needs it — for example a store locator that asks for location.
X-Content-Type-Options
X-Content-Type-Options: nosniffStops browsers guessing file types, which prevents an uploaded file from being executed as a script. Safe on essentially every site.
Certificates and TLS
If the report flags an expired, mismatched or missing certificate, fix that before anything else — the rest of the checks depend on a working secure connection.
- Free certificates: Let's Encrypt (via Certbot or your control panel), your host's built-in certificate, or Cloudflare's.
- Cover every name people use: a certificate issued only for
example.comwill fail onwww.example.com. Include both, and redirect one to the other. - Keep renewal automatic: most expired-certificate outages are a renewal job that quietly stopped running. Check that the renewal timer is active and that reload hooks restart the web server.
- Disable old protocols: serve TLS 1.2 and 1.3 only, and redirect all HTTP traffic to HTTPS before enabling HSTS.
Where to put the configuration
The same headers, in the form your platform expects.
Apache
# .htaccess or the site's <VirtualHost> block (needs mod_headers)
Header always set Content-Security-Policy "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; form-action 'self'"
Header always set Strict-Transport-Security "max-age=31536000"
Header always set X-Content-Type-Options "nosniff"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"Nginx
# Inside the server { } block, then: sudo nginx -t && sudo nginx -s reload
add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; form-action 'self'" always;
add_header Strict-Transport-Security "max-age=31536000" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;Note that adding an add_header inside a nested block replaces the ones inherited from the parent block, so repeat the full set where you use it.
Vercel
// vercel.json at the repository root
{
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; form-action 'self'"
},
{ "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=()" }
]
}
]
}Netlify
# public/_headers (or the folder you publish)
/*
Content-Security-Policy: default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; form-action 'self'
Strict-Transport-Security: max-age=31536000
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()Cloudflare
Dashboard → your domain → Rules → Transform Rules → Modify Response Header
1. Create rule, apply to: All incoming requests
2. Set static header Content-Security-Policy → default-src 'self'; frame-ancestors 'none'
3. Add one "Set static" row per header from the baseline above
4. Deploy, then re-check — Cloudflare may already add some of themVerify the change
Headers are served by the edge as well as your server, so confirm the change reached real visitors rather than assuming the config took effect.
- 1. Read the live response headers yourself:
curl -sSI https://example.com | grep -iE 'content-security-policy|strict-transport|x-content-type|referrer-policy|permissions-policy|x-frame-options'- 2. Run the site through Website Analyzer again. If your CDN or host caches responses, purge the cache first — a fresh check can still show the old headers for a few minutes.
- 3. For an independent second opinion, use securityheaders.com for headers and SSL Labs for certificates and TLS.
Still stuck?
If your report shows something this page does not cover, send the details and I will take a look.