gpt4 book ai didi

cors - AMP Email Playground 的正确 AMP-Access-Control-Allow-Source-Origin 响应 header 是什么?

转载 作者:行者123 更新时间:2023-12-04 01:08:49 24 4
gpt4 key购买 nike

amp-email "security requirements" 的文档状态:

All responses must echo the origin and __amp_source_origin values from above if they are valid:

Access-Control-Allow-Origin: https://amp.gmail.dev
AMP-Access-Control-Allow-Source-Origin: amp@gmail.dev
Access-Control-Allow-Source-Origin: AMP-Access-Control-Allow-Source-Origin

If the response doesn't contain these values, the CORS request fail, resulting in a browser console warning message.

我正在 Playground 上测试 amp-list 的使用,我的回复包含这些标题。但是,数据没有出现,并且在控制台中我收到以下错误:Request xhr failed: The amp-access-control-allow-source-origin must be equal to the amp source origin sent in the request。 ​​​请求中提供的amp_source_origin如预期的那样是amp@gmail.dev

这是我返回的相关响应 header 的副本:

Access-Control-Allow-Origin: https://amp.gmail.dev
Access-Control-Allow-Source-Origin: AMP-Access-Control-Allow-Source-Origin
Amp-Access-Control-Allow-Source-Origin: amp@gmail.dev

我需要提供一些额外的标题吗?

最佳答案

Gmail AMP Playground 中 CORS 的正确 header 如下:

Access-Control-Allow-Origin: https://amp.gmail.dev
AMP-Access-Control-Allow-Source-Origin: amp@gmail.dev
Access-Control-Expose-Headers: AMP-Access-Control-Allow-Source-Origin

Gmail 的文档最初有一个错误,即错误地使用了 Access-Control-Allow-Source-Origin 而不是 Access-Control-Expose-Headers,但现在是这样固定。

关于cors - AMP Email Playground 的正确 AMP-Access-Control-Allow-Source-Origin 响应 header 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56137499/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com