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
- Choose a framing policy: DENY blocks all framing, SAMEORIGIN allows only same-origin frames.
- ALLOW-FROM restricts framing to one URI (legacy, limited browser support — prefer CSP frame-ancestors).
- The tool shows the X-Frame-Options header value and the equivalent Content-Security-Policy frame-ancestors directive.
- Copy a ready-to-paste config block for Nginx, Apache, or IIS 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.