Getting your security headers right is a one-afternoon project. You configure HSTS, add a Content Security Policy, set X-Frame-Options and X-Content-Type-Options, and your scanner shows green across the board. Then three months later a deployment resets your nginx config, a CDN policy change overrides your response headers, or a framework upgrade changes the default middleware — and your headers silently disappear.
This is the part most security guides don't cover: headers need to be monitored continuously, not just configured once.
Security header regressions are almost never intentional. They happen as side effects of routine operations:
A new Docker base image, an updated nginx configuration template, or a framework upgrade can silently reset headers to defaults. If your security headers are set at the application layer, a deployment that reverts that configuration removes them. If they're at the server layer, any server reconfiguration risks losing them.
CDNs like Cloudflare, Fastly, and CloudFront can set, override, or strip response headers. A CDN configuration change — moving to a different cache tier, changing an edge rule, updating a WAF policy — can remove headers that were previously being injected at the CDN layer. Worse, CDN headers and origin headers can interact unexpectedly when both try to set the same header.
Migrating from one hosting provider to another, from EC2 to containers, from containers to serverless — the security headers were configured on the old infrastructure and need to be explicitly re-configured on the new one. This is frequently missed.
Your main domain might have a hardened security configuration while subdomains (api.example.com, app.example.com, admin.example.com) have weaker or missing headers. A change to subdomain configuration that seemed unrelated can affect header presence.
The six headers with the most impact on your security posture:
For each header, you want to monitor both presence (is the header set at all?) and value (has the value weakened? a CSP that was restrictive but is now default-src * is almost worse than no CSP).
# Check all response headers (look for security headers in output)
curl -I https://yoursite.com
# Check a specific header
curl -s -I https://yoursite.com | grep -i "strict-transport\|content-security\|x-frame\|x-content-type"
Open DevTools → Network → click your page's request → Headers tab → Response Headers. You can see all headers the server is returning.
Manual spot checks are useful for audits but don't catch regressions immediately. Automated monitoring runs on a schedule, compares your current headers to a known-good baseline, and alerts you when anything changes.
#!/bin/bash
# security-headers-check.sh — run daily via cron
SITE="https://yoursite.com"
ALERT_EMAIL="security@yourcompany.com"
REQUIRED_HEADERS=(
"Strict-Transport-Security"
"X-Frame-Options"
"X-Content-Type-Options"
)
for HEADER in "${REQUIRED_HEADERS[@]}"; do
VALUE=$(curl -sI "$SITE" | grep -i "^$HEADER:" | head -1)
if [ -z "$VALUE" ]; then
echo "MISSING: $HEADER not present on $SITE" | \
mail -s "⚠️ Security header missing: $HEADER" "$ALERT_EMAIL"
fi
done
This catches absent headers but not weakened values. For CSP monitoring, you'd need to store the expected value and diff against it.
Add a security header check to your deployment pipeline — run after each deploy and fail the deploy if critical headers are missing:
# GitHub Actions step — add after deployment
- name: Check security headers
run: |
HSTS=$(curl -sI ${{ env.PRODUCTION_URL }} | grep -i "strict-transport-security")
if [ -z "$HSTS" ]; then
echo "ERROR: HSTS header missing after deployment"
exit 1
fi
echo "HSTS present: $HSTS"
This catches regressions at deploy time but doesn't monitor for changes that happen outside deployments (CDN config changes, infrastructure incidents).
A dedicated service checks your headers on a schedule from external infrastructure and alerts you when any header changes value or disappears — regardless of whether it was caused by a deployment, CDN change, or anything else.
Advantages over the DIY approaches:
HeaderGuard monitors your site's HSTS, CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, and Permissions-Policy. Get an email alert within minutes when any header changes value, weakens, or disappears. $9/month for up to 10 domains.
Join the HeaderGuard waitlist → Check your headers freeA mature security header monitoring setup has three components:
The CI/CD gate catches most regressions. External monitoring catches the rest. A periodic audit ensures your headers are getting stricter over time, not just present.
← All articles · HeaderGuard · Free security headers checker