amazon-web-services - AWS CORS 启用 - 需要在哪里启用? chalice ?发电机?还是S3?

标签 amazon-web-services amazon-s3 aws-lambda chalice

尝试使用aws。
我已经完成了以下操作。

创建了一个 dynamodb 表。

创建了 Chalice 应用程序以通过 api 访问数据。

使用上面的 api 创建了一个 Angular6 应用程序来对表进行 CRUD 操作。

当 Angular 应用程序在本地时,一切正常。现在我将我的 Angular 应用程序上传到 S3,之后我收到了 CORS 错误。

根据文档,我确实在 s3 存储桶上设置了 CORS 规则,但错误仍然存​​在。

除了 S3 存储桶,我还需要在其他地方设置 CORS 规则吗?

错误截图:

enter image description here

S3 存储桶 CORS 配置:

enter image description here

最佳答案

在 API 网关上设置 CORS 没有帮助,但在 chalice app.py 上设置 cors=True 确实有帮助。根据文档,它们都应该以相同的方式表现,但在我的情况下它没有帮助。

@app.route('/gsgl/update', methods=['PUT'],cors=True)

引用:https://github.com/aws/chalice#tutorial-cors-support

关于amazon-web-services - AWS CORS 启用 - 需要在哪里启用? chalice ?发电机?还是S3?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51943508/

相关文章:

amazon-web-services - Dockerfile中的AWS凭证

amazon-web-services - "A statement of the security measures and mechanisms you will be implementing"AWS(解锁端口 25)

amazon-web-services - AWS s3 控制台显示意外错误并且存储桶不可见

security - 备份至云端

java - json.simple.JSONObject 无法使用 AWS Lambda JAVA 转换为 java.lang.String

node.js - 如何在AWS Lambda中提取特殊字符参数?

amazon-web-services - 事件完成后触发 AWS lambda

url - 限制我的移动应用程序访问云端签名 URL(GET 请求)

c# - 如何从 AWS S3 存储下载字节数组形式的文件?

java - 如何使用适用于 S3 的 AWS Java SDK 查询 AWS S3 存储桶以匹配对象(文件)名称