[尝试将AMP表单提交到Azure Logic应用程序时出现CORS错误

问题描述 投票:0回答:1

我有一个简单的AMP网页,其中包含要提交给Azure Logic应用程序的表单。我正在加载

<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>

在我的HTML头中,因此我可以使用表单验证中内置的AMP。

但是,当我提交表格时,出现以下错误...

Access to fetch at 'https://prod-logic-app-url' from origin 'https://www.example.com' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.

我无法在Azure Logic应用程序中找到与CORS相关的设置,而且我不知道如何从AMP表单发送已修改的标题或其他标题。

cors amp-html azure-logic-apps
1个回答
0
投票
[尝试将WordPress Jetpack插件的MailChimp模块转换为AMP兼容时出现此问题。

在原始非AMP页面上,表单提交导致此fetchSubscription()功能为called

https://public-api.wordpress.com/rest/v1.1/sites/…打开XHR,并且WordPress.com REST API包括响应:

Access-Control-Allow-Origin: *

所以,再添加两个响应头,如下所示:

AMP-Access-Control-Allow-Source-Origin: https://example.com Access-Control-Expose-Headers: AMP-Access-Control-Allow-Source-Origin

有关更多详细信息,您可以参考此issue
© www.soinside.com 2019 - 2024. All rights reserved.