简体   繁体   English

X-Frame-Options:ALLOW-FROM HTTP和HTTPS

[英]X-Frame-Options: ALLOW-FROM HTTP and HTTPS

With "X-Frame-Options: ALLOW-FROM" how can i allow one domain but with http and https requests? 使用“X-Frame-Options:ALLOW-FROM”我如何允许一个域但使用http和https请求?

I have the header below but the client also server the site in http://www.example.com . 我有下面的标题,但客户端也在http://www.example.com服务该网站。

X-Frame-Options: ALLOW-FROM https://www.example.com

Seems like there's no option for allowing both HTTP and HTTPS schemes within the same ALLOW-FROM header. 似乎在同一ALLOW-FROM标头中不允许同时允许HTTP和HTTPS方案。 Quoting from the spec . 引用规范

As the "ALLOW-FROM" field only supports one serialized-origin, in 由于“ALLOW-FROM”字段仅支持一个序列化原点,因此
cases when the server wishes to allow more than one resource to frame its content, the following design pattern can fulfill that need: 如果服务器希望允许多个资源构建其内容,则以下设计模式可以满足该需求:

  1. A page that wants to render the requested content in a frame supplies its own origin information to the server providing the content to be framed via a query string parameter. 想要在帧中呈现所请求内容的页面将其自己的原始信息提供给服务器,该服务器通过查询字符串参数提供要成帧的内容。

  2. The server verifies that the hostname meets its criteria, so that the page is allowed to be framed by the target resource. 服务器验证主机名是否符合其条件,以便允许页面由目标资源构成。 This may, for example, happen via a lookup of a whitelist of trusted domain names that are allowed to frame the page. 例如,这可以通过查找允许构建页面的可信域名的白名单来实现。 For example, for a Facebook "Like" button, the server can check to see that the supplied hostname matches the hostname(s) expected for that "Like" button. 例如,对于Facebook“赞”按钮,服务器可以检查所提供的主机名是否与该“赞”按钮所期望的主机名匹配。

  3. The server returns the hostname in "X-Frame-Options: ALLOW-FROM" if the proper criteria was met in step #2. 如果在步骤#2中满足适当的标准,则服务器在“X-Frame-Options:ALLOW-FROM”中返回主机名。

  4. The browser enforces the "X-Frame-Options: ALLOW-FROM" header. 浏览器强制执行“X-Frame-Options:ALLOW-FROM”标头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM