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

Generated Headers

X-Frame-Options

            
CSP frame-ancestors (recommended)

            

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.

X-Frame-Options
Legacy HTTP header. Supported by all browsers including IE. Does not support multiple origins. ALLOW-FROM is deprecated and unsupported in Chrome/Firefox.
CSP frame-ancestors
Modern standard. Supports multiple origins, wildcards, and nonces. Takes precedence over X-Frame-Options in modern browsers. Recommended for all new deployments.
Copied!

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

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

Frequently Asked Questions

Last updated: 2026-07-01 · Reviewed by Nham Vu