Clickjacking protection
Clickjacking loads your site in a hidden iframe to hijack clicks. X-Frame-Options or a CSP frame-ancestors directive stops it — here's how.
What it is
Clickjacking protection stops another site from loading yours inside an invisible <iframe> and tricking a visitor into clicking something they didn't mean to. It's enforced with either the X-Frame-Options header or a Content-Security-Policy frame-ancestors directive.
Either one is sufficient on its own; a page needs at least one to pass this check.
Why it matters
A page with neither can be framed by any origin, then overlaid with a fake button or form the attacker controls. The classic attack tricks a logged-in visitor into an unintended action — a purchase, a permission grant — while they think they're clicking something else entirely.
Setting X-Frame-Options: DENY (or SAMEORIGIN, if the page legitimately needs to be framed by its own origin) is a one-line fix with no functional downside for a page that was never meant to be embedded elsewhere.
How to fix it
with a reference docadd_header X-Frame-Options "DENY" always;Header always set X-Frame-Options "DENY"async headers() {
return [{
source: '/(.*)',
headers: [{ key: 'X-Frame-Options', value: 'DENY' }]
}];
}/*
X-Frame-Options: DENYRelated checks
3This is one of the 75 checks the scanner runs. See what we check for the full list, every severity weight, and how the score is computed from them.