问题描述
我创建了一个使用无服务器(serverless.com)的 API 端点,我通过 API 网关公开了该端点.尽管我已从
启用 CORS,但我收到以下错误XMLHttpRequest 无法加载
尽管我设置了 origin
标头,但当我使用 Postman 发出请求时,我没有收到任何错误.我该如何解决这个问题?
我们现在有一个错误,即对 API 网关的失败请求不会包含适当的 CORS 标头,这会掩盖请求中的实际错误.
我想补充一下 Ken 所说的内容,并确保您已经彻底测试了控制台中的 API 和资源,以及使用 Postman 或其他非浏览器客户端的已部署版本.我预计 API 本身存在问题,并且您的 CORS 配置正确.
I have created an API endpoint with Serverless(serverless.com) which I expose through API Gateway. I'm getting following error though I have enabled CORS from the
I don't get any errors when I use Postman to make requests, despite I have set origin
header or not. How can I fix this problem?
We have a bug right now where failed requests to API Gateway won't include the appropriate CORS headers, which masks the actual error on the request.
I'd add to what Ken said and make sure you've thoroughly tested the API and resources in the console and also on the deployed version using Postman or some other client that isn't a browser. I expect there is an issue with the API itself and that your CORS configuration is correct.
这篇关于从 S3 上的静态站点发布时,AWS API Gateway 端点出现 CORS 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!