HTTP headers | XFrameOptions (original) (raw)

HTTP headers | X-Frame-Options

Last Updated : 28 Apr, 2023

HTTP headers are used to pass additional information with HTTP responses or HTTP requests. The X-Frame-Options is used to prevent the site from clickjacking attacks. It defines whether or not a browser should be allowed to render a page in a , , , or . The frame-ancestors directive present in Content-Security-Policy(CSP) obsoletes X-Frame-Options.

Syntax:

X-Frame-Options: directive

Directives:

Examples:

Header always set X-Frame-Options "sameorigin"

header always set x-frame-options "DENY"

add_header x-frame-options "SAMEORIGIN" always;

Supported Browsers: The browsers supported by X-Frame-Options are listed below:

Note: Only Internet Explorer and Microsoft Edge support the allow-from directive.