Check the security headers
For administrators and hosting teams, after a change of the web server, a deploy, or monthly as evidence. The commands come from Security and audit, 1 and 13.9.
Contents
Before you start
- A shell with
curl, outside the server's network if possible (a check from inside can bypass a proxy). - The list of host names: public siteaccesses and the administration.
Steps
for host in www.example.gov admin.example.gov; do
echo "== $host"
curl -sI "https://$host/" | grep -i -E 'x-content-type|x-frame|referrer|permissions|content-security|strict-transport'
curl -sI "https://$host/user/login" | grep -i set-cookie
done
for p in .env .git/config settings/site.ini composer.json extension/expservices/ezinfo.php; do
curl -s -o /dev/null -w "$p %{http_code}\n" "https://www.example.gov/$p"
doneWhat to expect
| Check | Expected |
|---|---|
x-content-type-options | nosniff |
x-frame-options | SAMEORIGIN |
content-security-policy | frame-ancestors 'self'; on the administration also a policy or a report-only policy |
referrer-policy | strict-origin-when-cross-origin |
permissions-policy | camera=(), microphone=(), payment=(), usb=() |
strict-transport-security | your value, once set |
| session cookie | Secure; HttpOnly; SameSite=Lax |
| internal files | 404, or an Exponential page, never the file's content |
A missing header after a change usually means an override replaced the list or a proxy strips headers.
Recording the result
Save the output with the date and host in your security documentation. Compare with the previous month; any difference needs an explanation.
Related pages
- Security headers
- Add HSTS
- Go-live security checklist
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.