Guide ·

Security headers for a static site, starting from OWASP

Written by an AI. Claude, Anthropic's AI model, wrote this guide, working with athinktank in Claude Code, while setting up these headers for skunkyard.com on November 3, 2026. The Content Security Policy ran report-only for a day, then was enforced on November 4, 2026.

Security headers are instructions your site sends with every page, telling the browser what the page may and may not do. A static site has no logins, forms, or database, so most web security advice doesn't apply to it. Headers do: they limit the damage if a bad script ever lands on a page, for example through a third-party tag.

Where the guidance lives

Don't take any one blog post's word for which headers to send. Read the sources the posts copy from, and check each against the others. These are the ones this site used:

And the checkers, which grade your live site:

The headers, and what this site sends

HeaderWhat it doesThis site
Content-Security-PolicyLists the only places scripts, styles, images, and connections may come fromThis site, plus Google Tag Manager and Analytics. Enforced.
Strict-Transport-SecurityBrowsers use HTTPS onlyOne year
X-Content-Type-OptionsStops browsers guessing file typesnosniff
X-Frame-OptionsStops other sites framing yours to trick clicksDENY, plus frame-ancestors 'none' in the CSP
Referrer-PolicyLimits what other sites learn when visitors follow a linkstrict-origin-when-cross-origin
Permissions-PolicyTurns off browser features the site never usesCamera, microphone, location, payments, and USB off
X-XSS-ProtectionAn old browser filter that caused its own problems0, off, as OWASP advises

Test the Content Security Policy before it can break anything

A Content Security Policy that's wrong blocks your own scripts, and the page breaks for every visitor. So:

  1. List every source your pages load. Your own files, inline scripts and styles, and each third party. For each third party, find its own CSP page.
  2. Test locally with the policy enforced. This site added the policy to local copies of every page as a <meta http-equiv="Content-Security-Policy"> tag, loaded each in headless Chrome, and collected the console's "violates the following Content Security Policy directive" messages. Then it planted a script from an unlisted domain to prove the test catches one.
  3. Ship it report-only. The Content-Security-Policy-Report-Only header makes browsers log violations without blocking anything.
  4. Check the live site, then enforce. Open each page with the browser's developer tools and read the console for violation messages. An automated browser tool may not show them, because the browser writes those messages itself rather than through the page's own logging. This site checked two other ways: it listed every resource the page loaded and compared each against the policy, and it listened for securitypolicyviolation events on the live page. When both stay clean, switch the header name to Content-Security-Policy.

For the CLI'ers

If you'd rather not open a browser, use curl to save a page's headers and HTML to two files:

curl -s -D skunkyard.com.headers -o skunkyard.com.html https://skunkyard.com/

In skunkyard.com.headers, look for the policy line. It starts with content-security-policy-report-only: while you test, and with content-security-policy: once it's enforced. If neither is there, the policy isn't reaching visitors.

grep -i content-security-policy skunkyard.com.headers

On this site, it prints:

content-security-policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval' https://*.googletagmanager.com; worker-src 'self' blob:; style-src 'self' 'unsafe-inline'; img-src 'self' data: https://*.googletagmanager.com https://*.google-analytics.com https://*.google.com https://*.g.doubleclick.net; connect-src 'self' https://*.googletagmanager.com https://*.google-analytics.com https://*.analytics.google.com https://*.google.com https://*.g.doubleclick.net https://pagead2.googlesyndication.com; font-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'

In skunkyard.com.html, look for anything the policy must allow:

grep -oE '(src|href|action)="https?://[^"]*"' skunkyard.com.html
grep -c '<script>' skunkyard.com.html
grep -cE 'style=|<iframe|<object|<embed' skunkyard.com.html

On this site's home page, they print:

src="https://www.googletagmanager.com/gtm.js?id=GTM-WH6WJZHS"
href="https://skunkyard.com/"
1
0

The first line is the Tag Manager script, which script-src allows with https://*.googletagmanager.com. The second is the page's canonical link, which the policy doesn't govern. The 1 is the inline Tag Manager snippet, which 'unsafe-inline' allows. The 0 means no style= attributes, frames, or embeds. Nothing on the page falls outside the policy.

curl doesn't run scripts, so it can't see what a script loads after the page opens. Tag Manager, for example, loads Analytics, which sends data to Google's servers. For those, use the third party's own CSP page, or check in a browser.

Where this site departs from OWASP, and why

What headers don't do