AppInspected

Fix guides

"Page can be embedded by other sites": how to fix it

Last reviewed November 22, 2026 against the providers' current documentation.

The short version

Send X-Frame-Options: DENY (or SAMEORIGIN if your own site frames its pages) as an HTTP response header on every HTML page, and add frame-ancestors 'none' (or 'self') to your Content-Security-Policy header. Neither works in a <meta> tag, so it has to come from your host's config or your server. Only if another site really needs to embed you, list it in frame-ancestors; the old ALLOW-FROM value no longer works.

Why it matters

Clickjacking is when another site loads your app in an invisible or disguised frame and tricks your signed-in users into clicking something on it, such as a "Delete account", "Pay" or "Share" button, while they think they're clicking on the attacker's page. Chrome's Lighthouse docs define it as users being "tricked into clicking on links or UI elements on a site that appears to be a trusted and familiar site". The fix is for your pages to tell the browser who may frame them. That's what X-Frame-Options and the CSP frame-ancestors directive do. Lighthouse's audit passes with either one; OWASP calls X-Frame-Options obsoleted by frame-ancestors but still recommends using more than one defence. It's rated low on our free check because it needs a signed-in user and a page with a button worth tricking someone into, but on an app with accounts or payments it's cheap insurance.

Fix it, in this order

  1. See what your pages send now

    Run the free headers check on your live address. Page can be embedded by other sites means the page had neither an X-Frame-Options header nor a Content-Security-Policy header containing frame-ancestors. From a terminal: curl -sI https://yourdomain.com | grep -iE 'x-frame-options|content-security-policy'. Our check reads only the enforced Content-Security-Policy header, so a frame-ancestors inside Content-Security-Policy-Report-Only doesn't count.
  2. Pick the value

    DENY / frame-ancestors 'none': no site may frame the page. OWASP recommends this unless you've found a specific need for framing. SAMEORIGIN / frame-ancestors 'self': only your own site may frame it; use this if your app shows its own pages in an iframe. If another domain must embed you (a partner site, your marketing site on a different domain), list it: frame-ancestors 'self' https://www.example.com. X-Frame-Options can't do that: OWASP says ALLOW-FROM "no longer works in modern browsers" and leaves you with no protection, so drop it and use frame-ancestors.
  3. Send it as a header, not a meta tag

    AI builders often add <meta http-equiv="X-Frame-Options"> to index.html. It does nothing: the X-Frame-Options RFC says browsers explicitly ignore it in a meta tag, and MDN says frame-ancestors isn't supported in a <meta> CSP either. Add it where your host sets response headers:
    # Netlify, Cloudflare Pages or Workers static assets: _headers in your static folder (Vite: public/)
    /*
      X-Frame-Options: DENY
      Content-Security-Policy: frame-ancestors 'none'
    
    # Vercel: vercel.json
    { "headers": [ { "source": "/(.*)", "headers": [
      { "key": "X-Frame-Options", "value": "DENY" },
      { "key": "Content-Security-Policy", "value": "frame-ancestors 'none'" } ] } ] }
    
    # nginx: server block (always = also on error pages)
    add_header X-Frame-Options "DENY" always;
    add_header Content-Security-Policy "frame-ancestors 'none'" always;
    
    # Apache (mod_headers)
    Header always set X-Frame-Options "DENY"
    Header always set Content-Security-Policy "frame-ancestors 'none'"
    
    # Express (Replit and other Node servers): Helmet sends SAMEORIGIN + frame-ancestors 'self' by default
    app.use(helmet({ xFrameOptions: { action: "deny" } }))
    Helmet already sends X-Frame-Options: SAMEORIGIN and a CSP with frame-ancestors 'self' by default; use helmet({ xFrameOptions: { action: "deny" } }) for DENY. If you already have a Content-Security-Policy header, add frame-ancestors to it rather than sending a second policy. More per-host detail: Netlify, Vercel, CSP for React + Vite.
  4. Cover every HTML response

    OWASP says to set it "for all responses containing HTML content", and Chrome's docs say the policy must be on the headers of the document request itself. Use a catch-all path (/* or /(.*)). Cloudflare's docs say _headers rules aren't applied to responses from Pages Functions or Worker code, so server-rendered pages there must set the header in code. On nginx, a location block with its own add_header lines doesn't inherit the ones from the server block, and without always the header is skipped on error responses.
  5. Check it worked

    Rerun the headers check or the curl command on the home page and one deeper page. To see it in action, save <iframe src="https://yourdomain.com" width="600" height="400"></iframe> as a local HTML file and open it: with DENY or 'none' your page doesn't load inside the frame (the browser shows a blank or error frame instead).

Or ask your AI tool to do it

Paste this into Lovable, Bolt, Cursor, Claude Code or whichever tool built your app. Review what it changes before you deploy.

Protect my web app against clickjacking. Send the HTTP response header X-Frame-Options: DENY on every HTML response, and add frame-ancestors 'none' to the Content-Security-Policy header (add it to my existing policy if there is one; don't create a second policy). If my app shows its own pages in an iframe, use SAMEORIGIN and frame-ancestors 'self' instead, and tell me which pages do that. Use my host's header config, not a meta tag (meta tags are ignored for both): a _headers file in the static folder that gets copied to the build output (Netlify, Cloudflare Pages, Cloudflare Workers static assets; for Vite that's public/), vercel.json headers on Vercel, add_header ... always in nginx, Header always set in Apache, or helmet() in Express. Make sure pages rendered by server code or functions get the headers too. Remove any X-Frame-Options ALLOW-FROM value.

How this happens

Framing protection is a response header, and AI builders like Lovable, Bolt, v0 or Cursor write the app, not the hosting config. Most hosts don't add it by default (Vercel's HTTPS docs mention only HSTS), so it's missing unless someone adds a headers file. When the AI does try, it often puts it in a <meta> tag in index.html, which browsers ignore for this header.

Check that it's really fixed

After you deploy, run the free check. It reads your live site the way an attacker would and tells you if any secret key is still visible.

Topic check: Security headers check

Find the other leaks before someone else does

The free check reads your home page and its scripts. The website security report goes through up to 30 pages and 40 JavaScript files, plus .env and .git files, security headers, cookies and CORS, domain and email records, and libraries with known vulnerabilities. Every finding comes with the fix for your host and a prompt for your AI tool.

$19 once, including 20 runs over 30 days so you can fix things and check again.

Get the report, $19 See an example report

Example report header: a score out of 100, findings by severity, Download PDF and Email me this report.

Questions

Should I use X-Frame-Options or CSP frame-ancestors?

Both is the simple answer. frame-ancestors is the modern one and the only way to allow specific other sites; OWASP describes X-Frame-Options as obsoleted by it, and the CSP spec (quoted by OWASP) says browsers ignore X-Frame-Options when an enforced frame-ancestors is present. Sending X-Frame-Options too costs nothing and covers older browsers. Either one alone passes our check and Lighthouse's audit.

DENY or SAMEORIGIN?

DENY unless your own site puts its pages in iframes; OWASP recommends DENY (or frame-ancestors 'none') unless a specific need for framing has been identified. SAMEORIGIN is what Helmet sends by default and what our $19 report suggests as a safe starting point.

Why doesn't my meta tag work?

Because browsers ignore both in a meta tag. RFC 7034 says X-Frame-Options must be sent as an HTTP header and is explicitly ignored in a meta http-equiv tag; MDN and Chrome's docs say the same of frame-ancestors. Move it to your host's header config.

How do I let one other site embed my app?

Use Content-Security-Policy: frame-ancestors 'self' https://partner.example and don't send X-Frame-Options on those pages (it has no value for "this one site"). X-Frame-Options: ALLOW-FROM no longer works in modern browsers, OWASP says, so it leaves you unprotected.

Do SameSite cookies or frame-busting JavaScript fix this?

Not on their own. OWASP says SameSite=Lax or Strict cookies are withheld from cross-site iframes, which helps, but don't block framing and shouldn't be your only defence. It calls the simple if (top != self) frame-buster "NOT recommended" because there are public ways around it. The headers are the fix.

Is a missing X-Frame-Options header serious?

It's a low-severity finding: an attack needs a signed-in user lured to the attacker's page and a one-click action worth abusing. It matters more on apps with accounts, payments or admin buttons, and it's a common line in security questionnaires and pen-test reports, which is a good reason to fix it in five minutes.

Sources

Related guides