amazon-web-services - 尝试将文件上传到 S3 时出错:请求的资源上不存在“Access-Control-Allow-Origin”标头
问题描述
我正在尝试将文件从应用程序上传到 S3。
我收到以下错误
Access to XMLHttpRequest at 'https://yellow-pages-bahrain.s3.amazonaws.com/Chrysanthemum?AWSAccessKeyId=******************&Content-Type=jpg&Expires=1595840227&Signature=knHfUhZ7kqvWLAQlfsbCpzY96as%3D' from origin 'http://localhost:3003' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
我已将 CROS 策略配置为
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
我有什么遗漏吗。这还需要添加什么?
解决方案
推荐阅读
- python - 为什么在 py37 环境中安装 numpy 时需要指定“anaconda”通道
- angular - Angular 到 Spring Boot 微服务连接错误
- python - 如何在此处最小化代码以使其在 python3 中的内存效率更高?
- django - 将 Django 模板中的上下文中的 JSON 对象渲染为 Ajax DataTable
- wordpress - 如何在 Ultimate Member 选项卡插件上显示特定功能的简码
- javascript - React Semantic UI 如何使用“链接”
- html - 单击 WebBrowser 控件中的按钮
- python - 在列表中的 pandas 列中查找关键字匹配的数量
- r - 在 ggplot2 中的 geom_boxplot 内设置日期限制
- java - 如何使用 Xodus 删除实体类型?