首页 > 解决方案 > AMP HTML amp-ads - 阻止的帧、协议、域和端口必须匹配

问题描述

我正在尝试解决一个错误,该错误阻止我在我构建并托管在 nginx 服务器上的 amp-html 网站上显示 google-adsense 广告。我在 Stack Overflow、 Google AdsenseAmp By Example文档中搜索并阅读了很多类似的问题。

根据Google 的说明,我放置了一个 amp-ad 。页面本身可以正确加载,但广告应该是空白。在控制台中,我收到此错误(两次):

Blocked a frame with origin "https://d-1234567890.ampproject.net" from accessing a frame with origin "https://example.com". Protocols, domains, and ports must match.

我最近将 Nameservers 移到了一个新服务器上,该服务器现在支持https而不是http. 该网站似乎仍在 Adsense 中进行验证,但它是否试图通过错误的协议发送广告?

  1. 协议必须匹配——似乎是这样,因为两个站点都是 https。

  2. 域和端口必须匹配——好的,但是如何验证这些呢?

除此之外,除了盲目关闭安全措施外,我不太确定如何解决问题。我应该查看我的标题(X-Frame-Options,X-Content-Type-Options等)吗?还是我的Content-Security-Policy头?还是 Google Adsense 还在使用旧的 http 协议?

FWIW,我还在控制台中收到这些(相关)警告:

[Warning] The resource https://3p.ampproject.net/234567890/f.js was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it wasn't preloaded for nothing. [Warning] The resource https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it wasn't preloaded for nothing.

预先感谢您的帮助。

标签: nginxadsenseamp-htmlamp-ad

解决方案


推荐阅读