从S3上的静态站点进行POST时,AWS API Gateway端点提供CORS错误 [英] AWS API Gateway endpoint gives CORS error when POST from static site on S3

查看:1265
本文介绍了从S3上的静态站点进行POST时,AWS API Gateway端点提供CORS错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过API网关公开了Serverless(serverless.com)创建了一个API端点。我收到以下错误,但我已从

启用CORS


XMLHttpRequest无法加载



我使用Postman发出请求时没有收到任何错误,尽管我设置了 origin 头。如何解决这个问题?

解决方案

我们现在有一个错误,API Gateway的失败请求不包括适当的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

XMLHttpRequest cannot load https://xxxxxxxxx.execute-api.us-west-2.amazonaws.com/development/signup. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://yyyyyyyyy.com.s3-website-us-east-1.amazonaws.com' is therefore not allowed access.

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上的静态站点进行POST时,AWS API Gateway端点提供CORS错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆