MPH*_*MPH 7 nginx http-headers nextcloud
我现在使用Nextcloud(在Nginx上)一段时间了,我想将iframe用于另一个网站.但是标题不接受我的指令.
我将/var/www/nextcloud/lib/private/legacy/response.php中的标题选项更改为以下内容:
header('X-Frame-Options: ALLOW-FROM https://example.com');
但是,当我使用iframe创建示例网页时,它会出现以下错误:
Invalid 'X-Frame-Options' header encountered when loading 'https://nextcloud.example.com/apps/files/': 'ALLOW-FROM https://example.com' is not a recognized directive. The header will be ignored.
有人知道为什么这不起作用,提前谢谢.
R. *_*olt 19
allow-from是“过时的”。您可以改用Content-Security-Policy标题:
header('Content-Security-Policy: frame-ancestors https://example.com');
Run Code Online (Sandbox Code Playgroud)
MPH*_*MPH 10
回到这篇文章.不幸的是我发现了这个问题.Chrome不支持此选项,因此Chrome会向我提供错误,即iframe将我重定向到很多次.
但是该选项适用于Firefox(更多信息请访问:https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options).
| 归档时间: |
|
| 查看次数: |
17226 次 |
| 最近记录: |