X-Frame-Options Generator
Generate X-Frame-Options and CSP frame-ancestors headers to prevent clickjacking. Get ready-to-paste server config snippets for Nginx, Apache, and IIS.
Framing Policy
Enter the full origin URL allowed to frame your page.
X-Frame-Options: ALLOW-FROM is not supported by Chrome or Firefox and is removed from the specification. Use the CSP frame-ancestors directive shown below instead. The generated output includes the modern CSP equivalent.
Generated Headers
Server Configuration Snippets
What is Clickjacking?
Clickjacking (UI redress attack) tricks users into clicking elements they cannot see. An attacker embeds your site in a transparent iframe placed over a decoy page. When the user thinks they are clicking a harmless button, they are actually interacting with your site — transferring money, changing settings, or approving permissions without their knowledge.
Setting X-Frame-Options or Content-Security-Policy: frame-ancestors instructs browsers to refuse to render your page inside an iframe unless it comes from an allowed origin.
Summary
Generate X-Frame-Options and CSP frame-ancestors headers to prevent clickjacking. Get ready-to-paste server config snippets for Nginx, Apache, and IIS.
How it works
- Select a framing policy. DENY blocks all framing. SAMEORIGIN allows framing only from the same origin. ALLOW-FROM restricts framing to a specific URI — note this option has limited browser support and is deprecated in many browsers in favour of CSP frame-ancestors. The tool immediately shows the correct header syntax and equivalent Content-Security-Policy frame-ancestors directive, plus server configuration blocks you can paste directly into your web server.
Use cases
- Prevent clickjacking by ensuring your login or payment pages cannot be embedded in iframes.
- Allow a known partner domain to embed your widget while blocking all others via CSP frame-ancestors.
- Generate Nginx, Apache, or IIS config snippets ready to paste into your server configuration.
- Migrate from deprecated X-Frame-Options ALLOW-FROM to the CSP frame-ancestors equivalent.