我是AMP电子邮件的新手,现在正在尝试中!我正在电子邮件正文中使用amp-list组件来获取远程服务器json内容。但是,当我在浏览器控制台中签入时,出现以下js错误。邮件的Gmail收件箱中也收到空白。
Uncaught (in promise) Error: Class$obf_1013: [https://dynamicmail-pa.googleapis.com/v2/xhrs:proxy?alt=protojson] ti: Unsupported HTTP status: 400: Class$obf_1011: [object Object]
template-impl.js:241 Error proxying amp-list templates: Request viewerRenderTemplate failed: Error: Class$obf_1013: [https://dynamicmail-pa.googleapis.com/v2/xhrs:proxy?alt=protojson] ti: Unsupported HTTP status: 400: Class$obf_1011: [object Object]
答案 0 :(得分:1)
以下是要发送的正确标头,以使AMP在gmail中工作:
https://developers.google.com/gmail/ampemail/security-requirements?hl=ur#gmail
Access-Control-Allow-Origin: https://mail.google.com
AMP-Access-Control-Allow-Source-Origin: <your sender email address>
Access-Control-Expose-Headers: AMP-Access-Control-Allow-Source-Origin
答案 1 :(得分:0)
我们需要为CORS请求设置Content-Type和Access Control标头,例如-
header("Content-type: application/json");
header("Access-Control-Allow-Credentials: true");
header('Access-Control-Allow-Origin: *');