.htaccess htaccess中的跨域策略(COOP和COEP)

yqyhoc1h  于 2023-08-06  发布在  其他
关注(0)|答案(1)|浏览(140)

我收到了谷歌的通知,我应该在我的网站上启用COOP和COEP。来自Google的完整通知:

For Web Compatibility reasons Chrome is planning to require COOP/COEP for the use of SABs from Chrome 91 (2021-05-25) onwards. Please implement 'cross-origin-isolated' behavior on your site.

字符串
在网上搜索时,我发现了以下页面:https://web.dev/coop-coep/
在上一页中,添加了以下内容:

Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin


我的问题是我如何在我的.htaccess文件中添加上述行,以便它在Apache中工作。

iq0todco

iq0todco1#

我可以证实OP的上述评论。将以下两行添加到Web服务器的.htaccess文件中以启用COOP/COEP:

Header add Cross-Origin-Embedder-Policy "require-corp"
Header add Cross-Origin-Opener-Policy "same-origin"

字符串

相关问题