Question

Blocking iframe because it set 'X-Frame-Options' to 'DENY'.

I uploaded a project on the php server in my droplet which has both node and php server block on nginx. But when i opened it in the browser it isnt working because it works with i frames and in the console i see

Refused to display ‘myiframe’ in a frame because it set ‘X-Frame-Options’ to ‘DENY’.

And also Uncaught SecurityError: Failed to read the ‘contentDocument’ property from ‘HTMLIFrameElement’: Sandbox access violation: Blocked a frame at “https://www.mydomain.com” from accessing a frame at “null”. The frame being accessed is sandboxed and lacks the “allow-same-origin” flag.

What’s the most secure way to deal with those headers on nginx and php?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@tamburrinipietro89 Change it from DENY to SAMEORIGIN. That keeps a lot of the security, while it should make your app work. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options

I followed the same and changed in the ssl-params.conf but nothing seems to be changed.

I got this error on my Moodle site after installing the self-signed SSL certificate on my ubuntu 18.04 and 16.04 with apache2 web server installed on it. First, go to this location on your ubuntu server /etc/apache2/conf-available and open the file ssl-params.conf , which you must have created for installing an SSL certificate. Make this Change in the file from DENY to SMAEORIGIN Header always set X-Frame-Options SAMEORIGIN This worked for me.