Clickjacking protection (frame-ancestors / X-Frame-Options)
One of the checks in every audibot report. This page says exactly what audibot reads, what passes, and how to fix it.
What audibot checks
Whether the home page sends an X-Frame-Options header, or an enforced Content-Security-Policy containing frame-ancestors. A report-only policy does not count.
- Pass
X-Frame-Optionsis set, or the CSP restrictsframe-ancestors. - Warning
Neither is set, so any site can put this page in a frame.
Why it matters
Clickjacking loads a page in an invisible frame on top of another site and lines a button up under the visitor's cursor, so a click meant for the visible page lands on yours — while they are signed in to it.
How do I stop my site from being framed (clickjacking)?
frame-ancestors is the current mechanism; X-Frame-Options is the older one that every browser still honours. Sending both is harmless. Use 'none' / DENY if the site is never framed, 'self' / SAMEORIGIN if it frames itself.
nginx
add_header Content-Security-Policy "frame-ancestors 'self'" always;
add_header X-Frame-Options "SAMEORIGIN" always;Apache (mod_headers)
Header always set Content-Security-Policy "frame-ancestors 'self'"
Header always set X-Frame-Options "SAMEORIGIN"Caddy
header {
Content-Security-Policy "frame-ancestors 'self'"
X-Frame-Options "SAMEORIGIN"
}If you already send a CSP
Add the directive to it rather than sending a second header:
Content-Security-Policy: default-src 'self'; frame-ancestors 'self'Related tools
- Security headers checker — Check the HTTP security headers sent by a homepage.
- Security headers generator — Write security header settings for your web server or hosting platform.
Other checks in Security headers
- Strict-Transport-Security (HSTS) header
- Content-Security-Policy header
- X-Content-Type-Options: nosniff
- Referrer-Policy header
- Permissions-Policy header
- Software versions in response headers
- Cookie flags: Secure, SameSite and HttpOnly
- security.txt
Security headers in the methodology ·All guides
This check is one step of the website launch checklist.
Check your site
audibot runs this check and every other one in a single audit, and publishes the report with a recommendation for each finding.