Hello,

I'm trying to embed a page from Drupal via Iframe.
In the 7.50 Version, default by emitting the 'X-Frame-Options: SAMEORIGIN' header has been added. (https://www.drupal.org/node/2735873).
I'm trying to override this behavior in a page but it fails on FF & IE, and works well in Chrome.

My Steps are:
1. Make sure cache are enabled.
2. Implement hook_page_alter() and remove this behavior - header_remove('X-Frame-Options');
3. Add iframe in other external web a page from Drupal.
Iframe will show well on Chrome, in IE (my IE version is 11) it shows:

This content cannot be displayed in a frame
To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame.

Anyone had this issue? It seems like it's the cache system, since if i disable caching it works.

Thanks in advance.

Comments

tamarpe created an issue. See original summary.

bhavikshah9’s picture

Hi @tamarpe,

Why are you removing the header completely? Instead, try to set the value of this header to "ALLOW-FROM ".
Moreover, please refer this OWASP document

adam_’s picture

I ran into this issue and found this post, I wanted to add some info in case someone came in from search results.

The "ALLOW-FROM" header would be the best way to go about it once it's supported by all major browsers. Currently, it is not universally supported, at least as of this writing. See the support on the MDN web docs. Chrome, Edge and Opera have no support.

You can disable the header in Apache with a setting in the .htaccess file, but this will kill it site-wide.
Header unset X-Frame-Options

You can conditionally set it for a page as well.
SetEnvIf Request_URI ^path/to/open/page$ clickjackable
Header unset X-Frame-Options env=clickjackable

Version: 7.5 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.

quietone’s picture

Issue tags: -allow-from x-frame-options, -X-Frame-Options