Website security headers: how to check yours, and the order to fix them
Security headers are short instructions your website sends to every visitor’s browser. They are free to add, and two of them can break a site if added carelessly. This page shows how to read the headers your own site sends today, what each one prevents, what it can break, and an order that avoids a bad morning.
How to read the headers your site sends
Two ways. Both only load your home page, the same as any visitor.
- In a browser: open your site in Chrome, Edge or Firefox, press F12 to open the developer tools, choose the Network tab, reload the page, click the first entry in the list, and read the section called Response Headers.
- From a command line: on a Mac open Terminal, on Windows open Command Prompt, and type the line below with your own address. In Windows PowerShell, type
curl.exeinstead ofcurl.
curl -I https://yourdomain.com
You will get a list of lines in the form Name: value. Compare the names against the seven below. A header that is not in the list is not being sent.
What headers can and cannot do
A security header does not protect your server. It protects your visitor’s browser from being used against them: being tricked into clicking inside a hidden frame, running a script someone injected, or sending a login cookie over an insecure connection.
None of them stops someone who already has your password. All of them make browser-based attacks harder. They are also easy for anyone to check from outside, which is why they come up in security questionnaires.
Who can change them
It depends on where your site is hosted. On a hosted website builder, the platform sets most headers and you may have little control; ask its support which ones it sends and which you can change. On hosting where you control the server or a service in front of it, headers are a settings change. If someone else built your site, send them this page and the output of the command above.
The seven, ordered by value against risk
1. HSTS: force HTTPS, and keep forcing it
Strict-Transport-Security tells the browser to refuse plain HTTP for your site for a stated period. Without it, the first request a visitor types can travel unencrypted before your redirect runs.
Strict-Transport-Security: max-age=31536000; includeSubDomains
What it can break: anything of yours that still needs plain HTTP, including on a subdomain if you use includeSubDomains. Start with a short max-age (the number is in seconds), confirm nothing broke, then raise it. Leave preload out; it is hard to undo.
2. X-Content-Type-Options: no guessing
X-Content-Type-Options: nosniff
Stops the browser from second-guessing the file types you declare and running something you served as data. It rarely breaks anything on a correctly configured site.
3. Clickjacking protection: two headers, one job
Clickjacking is when someone loads your site invisibly inside a frame on their page, so your visitor clicks their button while believing it is yours.
Content-Security-Policy: frame-ancestors 'self' X-Frame-Options: SAMEORIGIN
Send both; the second covers older browsers. What it can break: any legitimate embedding of your pages on another site, such as a booking page shown inside a partner’s site. List those before you add it.
4. Referrer-Policy: stop leaking your own page addresses
Referrer-Policy: strict-origin-when-cross-origin
Limits how much of the address of the page a visitor was on gets passed to another site when they click an outbound link.
5. Cookie flags: for sites with logins
If your site has a login, the cookie that keeps a visitor signed in should carry three flags. Secure keeps it off plain HTTP. HttpOnly stops scripts on the page from reading it. SameSite limits when it is sent from other sites.
Set-Cookie: session=...; Secure; HttpOnly; SameSite=Lax; Path=/
What it can break: HttpOnly breaks any script that reads the cookie in the browser. SameSite=Strict can break logins that arrive from a link on another site. Test a real login in a private window afterward.
6. Content-Security-Policy: the powerful one, added carefully
CSP tells the browser which sources may load scripts, styles, images and frames on your pages. It is the strongest control here and the one most likely to break a live site, because real pages load from more places than anyone remembers: analytics, chat widgets, booking forms, fonts, maps.
Add it in report-only mode first:
Content-Security-Policy-Report-Only: default-src 'self'; script-src 'self' https://...
Report-only blocks nothing and shows what would have been blocked (you can see the messages in the browser’s developer tools console). Run it for about two weeks, add the legitimate sources, and only then move the same policy to the enforcing header. A CSP copied from another site will not fit yours.
7. Permissions-Policy: switch off what you never use
Permissions-Policy: camera=(), microphone=(), geolocation=()
Denies those browser features to the page and to anything embedded in it. If your site never asks for a camera, say so.
Two DNS settings worth knowing about
A CAA record names which certificate authorities may issue certificates for your domain. Set it to the authority your host actually uses, and update it before you change hosts or certificate renewal can fail.
DNSSEC adds signatures to your DNS records so the answer a visitor’s computer receives can be verified as the one you published. It is switched on at your registrar and DNS host. Turn it on at a quiet time, following their instructions exactly, because a mistake can take the whole domain offline until it is corrected.
The order that avoids an outage
- Read your current headers and save the output.
- Add the ones least likely to break anything:
nosniff,Referrer-Policy,Permissions-Policy. - Add clickjacking protection after listing every place your pages are legitimately embedded.
- Add cookie flags if you have logins, and test a real login in a private window.
- Add HSTS with a short
max-age, verify, then raise it. - Add CSP in report-only, read what it reports for about two weeks, then enforce.
- Add CAA to match your real certificate authority. Consider DNSSEC last.
Each step has a simple verification: run the header check again and see the new line, then confirm the site still works. If you cannot say what you would check afterward, you are not ready to make the change.
Headers are one item on the security basics checklist; the free exposure check covers the rest of what is visible from outside. If you are building your own site or app, as owners do in our AI classes, add these before launch, when nothing depends on the old behavior yet. Stuck on a step? Email solutions@ikonic303.dev.
FAQ
Do security headers matter for a simple site with no logins?
Less, but they still matter. Clickjacking and injected scripts affect your visitors and your name, and the low-risk headers take little effort to add.
My website platform sets some headers automatically. Is that enough?
Check what is actually being sent with the steps on this page. Platforms often set a few defaults. A Content-Security-Policy that fits your site depends on what your pages load, so a platform default may not cover it.
Does a perfect header score mean my site is secure?
No. It means the browser-side basics are in place. It says nothing about your passwords, backups, vendors or staff habits.
Can adding a header take my site down?
Two can cause problems if rushed: HSTS, if part of your site still needs plain HTTP, and Content-Security-Policy, if it blocks a script your pages depend on. Start HSTS with a short max-age and start CSP in report-only mode.
I use a website builder. Can I add these headers?
It depends on the platform. Some let you add custom headers and some do not. Read your current headers first, then ask the platform’s support which ones you can change.
The free exposure check · Email spoofing: SPF, DKIM, DMARC · How to test your own systems safely · Back to security
Get in touch
Email solutions@ikonic303.dev to get the next AI class date, to talk about marketing, or about one AI tool or job you want built. ikonic303 is based in Colorado, and classes are held in the Denver metro.
ikonic303 home · AI classes · what we built · free Anthropic courses · contact