Magento Tips & Tricks

Magento 2: Allow backend run in frame

Recently I’ve got request to make magento backend working in iframe. Quick googling gives me link to official documentation with instructions on how to setup storefront to be displayed in iframe. I did not pay attention to storefront word at that point. Backend still not work in iframe and gives an error:

Refused to display '' in a frame
because it set 'X-Frame-Options' to 'sameorigin'.

Apparently changes suggested by documentation did not work for backend. Further investigation gives me following files to check:


It appear that there is separate constant for backend in XFrameOptions.php. To update it you need to change following code:

/** Always send SAMEORIGIN in backend x-frame-options header */

Useful Links

Magento 1 not working in iframe?
Magento Documentation – X-Frame-Options header

Leave a Reply

Your email address will not be published. Required fields are marked *