我跟进了这个话题 https://meta.discourse.org/t/iframe-question/83167/3,但我认为我有点偏离了原题。
这个帖子 Iframe question - #3 - 成功加载了一个带有我博客文章描述的网址。然而,下面的 iframe 框甚至没有尝试加载,正如我在查看 Discourse 中的帖子时检查网络选项卡 (F12) 所发现的那样。没有一个请求指向 miniglot.com(在 Vercel 上托管的 Next.js,使用 Cloudflare 进行 DNS),只有 forum.miniglot.com(单独托管的 Discourse 服务器)。
帖子标记:
https://miniglot.com/blog/welcome-to-the-miniglot-community
<iframe url="https://miniglot.com/blog/welcome-to-the-miniglot-community"></iframe>
Discourse 设置 CORS 源:
- https miniglot.com
- https www.miniglot.com
Discourse 设置“允许的 iframe”:
- miniglot.com
- https www.miniglot.com
- https miniglot.com
- https miniglot.com/blog/welcome-to-the-miniglot-community
- https www.miniglot.com/blog/welcome-to-the-miniglot-community
我的 miniglot.com 上的 next.config.js:
… 虽然我不认为它相关,因为我没有看到服务器被调用:
...
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'X-Frame-Options',
value: 'ALLOWALL',
},
{
key: 'Content-Security-Policy',
value: "frame-ancestors 'self' https://forum.miniglot.com;",
},
],
},
]
},
...
有什么建议吗?我可能会暂时放弃 iframe,这很可惜,因为我认为这有助于新手理解我的 Discourse 上的“博客评论”类别是什么,以及它如何连接到博客页面。
