Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set X-Frame-Options Allow-From in nginx correctly

Im trying to set the ALLOWED-FROM in Nginx but all settings I tried so far resulted in the following Chrome error: Invalid 'X-Frame-Options' header encountered when loading 'https://domain.com/#/register': 'ALLOW-FROM domain.com' is not a recognized directive. The header will be ignored.

This options I tried are those: (tried also with FQDN with https:// prefix)

  add_header X-Frame-Options "Allow-From domain.com";    add_header X-Frame-Options "ALLOW-FROM domain.com";    add_header X-Frame-Options "ALLOW-FROM: domain.com";   add_header X-Frame-Options "Allow-From: domain.com";   add_header X-Frame-Options ALLOW-FROM "domain.com";   add_header X-Frame-Options ALLOW-FROM domain.com; 
like image 405
Vad1mo Avatar asked Jun 09 '15 11:06

Vad1mo


People also ask

What is X-Frame-Options deny?

X-Frame-Options:DENY is a header that forbids a page from being displayed in a frame. If your server is configured to send this heading, your sign-on screen will not be allowed to load within the embed codes provided by Credo, which use the iframe HTML element.


1 Answers

in Chrome and Safari you need to use Content-Security-Policy

Content-Security-Policy: frame-ancestors domain.com 

You can check more details on this site:

https://developer.mozilla.org/en-US/docs/Web/Security/CSP/CSP_policy_directives

like image 73
Ezequiel Bertti Avatar answered Sep 23 '22 15:09

Ezequiel Bertti