Frame Security Policy
Frame security controls whether your page can be embedded in iframes on other sites, protecting against clickjacking attacks.
43% of the 101 most-visited sites we scan fail this check. See the full data.
Results in 1–3 minutes · Free · No signup required
Want the result for your own site? Free Security Headers Checker — paste your domain, get the report.
Why It Matters
Clickjacking tricks users into clicking hidden elements by overlaying your page in a transparent iframe. Attackers can use this to steal clicks, credentials, or perform unauthorized actions.
How We Check
We check for X-Frame-Options header (DENY or SAMEORIGIN) and CSP frame-ancestors directive. We recommend using both for maximum browser compatibility.
Good vs Bad Values
| Value | Verdict | Why |
|---|---|---|
Content-Security-Policy: frame-ancestors 'none' | Good | Modern browsers refuse to render the page inside any frame. This is the current standard way to stop clickjacking, and it takes precedence over X-Frame-Options where both are present. |
Content-Security-Policy: frame-ancestors 'self' | Good | Only pages from your own origin may frame this one. Use it when you embed your own pages, for example in an app shell or a preview pane. |
Content-Security-Policy: frame-ancestors 'self' https://partner.example.com | Good | Explicit allowlist for a trusted embedder. This is the replacement for the removed ALLOW-FROM option. |
X-Frame-Options: DENY | Good | No framing at all. Works in every browser that ever supported the header, so it is a sensible companion to frame-ancestors. |
X-Frame-Options: SAMEORIGIN | Good | Same-origin framing only. Equivalent to frame-ancestors 'self' for legacy browsers. |
X-Frame-Options: ALLOW-FROM https://partner.example.com | Bad | ALLOW-FROM is obsolete and ignored by current browsers, and the scanner treats it as an invalid value. The page is framable by anyone. |
Content-Security-Policy: frame-ancestors * | Bad | Any site may embed the page. The directive exists, but it protects nothing. |
Content-Security-Policy: frame-ancestors https://*.example.com | Weak | A subdomain wildcard is legitimate, but a single compromised or abandoned subdomain can then frame the page. Our scanner flags any wildcard in this directive, so list hosts explicitly where you can. |
No X-Frame-Options and no frame-ancestors | Bad | The page can be loaded in a transparent iframe on an attacker's site and used for clickjacking. |
How to Fix
Add X-Frame-Options: DENY (or SAMEORIGIN if embedding is needed) and CSP frame-ancestors 'none' or frame-ancestors 'self'.
Nginx — send both headers; always makes them appear on error responses too:
add_header X-Frame-Options "DENY" always;
add_header Content-Security-Policy "frame-ancestors 'none'" always;
Apache (requires mod_headers):
Header always set X-Frame-Options "DENY"
Header always append Content-Security-Policy "frame-ancestors 'none'"
Next.js — next.config.js. If you already ship a full CSP, add frame-ancestors 'none' to it instead of sending a second header:
module.exports = {
async headers() {
return [{
source: "/(.*)",
headers: [
{ key: "X-Frame-Options", value: "DENY" },
{ key: "Content-Security-Policy", value: "frame-ancestors 'none'" },
],
}];
},
};
Express with Helmet: helmet.frameguard({ action: "deny" }) sets X-Frame-Options, and helmet.contentSecurityPolicy({ directives: { frameAncestors: ["'none'"] } }) sets the modern directive. Cloudflare: a Transform Rule that sets both response headers on all HTML responses.
Allowing one embedder. Keep the strict default and relax only the route that must be framed. Send frame-ancestors 'self' https://partner.example.com for that route and omit X-Frame-Options there, because the old header cannot name a third-party origin.
Verify with curl -sI https://example.com | grep -iE 'x-frame-options|frame-ancestors', then try to load the page from a test HTML file containing <iframe src="https://example.com">. The frame should stay blank and the console should report a refusal to display it.
Common Mistakes
- Putting `frame-ancestors` in a `<meta http-equiv="Content-Security-Policy">` tag. The directive is ignored there; it only works as an HTTP response header.
- Sending `frame-ancestors` in `Content-Security-Policy-Report-Only`. Report-only mode never blocks framing, so the page stays exposed.
- Using `X-Frame-Options: ALLOW-FROM`, `ALLOWALL` or a list of origins. The only valid values are `DENY` and `SAMEORIGIN`; anything else is dropped and, because the scanner sees an invalid value, the check fails even when frame-ancestors is present.
- Setting the header only on the home page. Clickjacking targets the pages with buttons, such as checkout, settings and login, so the header must be on every HTML response, including error pages.
- Forgetting that `frame-ancestors` does not fall back to `default-src`. A policy that sets only `default-src 'self'` does not restrict who can frame you.
- Breaking your own embeds (a widget, a customer-facing preview, a help-center embed) by adding `DENY` globally. Allow the embeddable routes with their own, narrower header.
Frequently Asked Questions
What is Frame Security Policy?
Frame security controls whether your page can be embedded in iframes on other sites, protecting against clickjacking attacks.
Why does Frame Security Policy matter for website security?
Clickjacking tricks users into clicking hidden elements by overlaying your page in a transparent iframe. Attackers can use this to steal clicks, credentials, or perform unauthorized actions.
How do I fix Frame Security Policy issues?
Add X-Frame-Options: DENY (or SAMEORIGIN if embedding is needed) and CSP frame-ancestors 'none' or frame-ancestors 'self'.
Related Security Checks
Related Tool
Security Headers Checker
Run all 10 related checks with our free security headers checker
Check Your Website Now
Run a free security scan to check for Frame Security Policy issues and 61 other security checks.
Scan Your Website Free