use*_*291 10 iframe webserver x-frame-options
我需要将服务器级别的X-Frame选项设置为:
- X-Frame-Options:SAMEORIGIN
- X-Frame-Options:ALLOW-FROM https://example.com/
了解X-Frame选项是互斥的.看到这里.
但是,我的应用程序需要在https://example.com和其SAMEORIGIN中进行构建.
请告知是否有解决方法,同时保留我的应用程序的要求,允许在同一来源 框架并在1个外部网站上框架.
或者这不可能吗?
Ada*_*ian 23
除了仅支持标题的一个实例之外,X-Frame-Options不支持任何不仅仅是一个站点SAMEORIGIN.
你必须使用Content-Security-Policy和frame-ancestors支持多个来源,如下所示:
Content-Security-Policy: frame-ancestors 'self' https://example.com
Run Code Online (Sandbox Code Playgroud)
要记住几个注意事项:
frame-ancestors废弃X-Frame-Options - 意味着如果frame-ancestors存在并且浏览器支持它,它将覆盖行为X-Frame-Options.frame-ancestors,Internet Explorer和Edge目前不支持该指令.这意味着他们会回归.如果您需要在IE或Edge中支持多个来源,请在SO上查看此答案,并提供解决方法.X-Frame-Options| 归档时间: |
|
| 查看次数: |
14243 次 |
| 最近记录: |