Error while trying to upload File into S3 :No 'Access-Control-Allow-Origin' header is present on the requested resource

故事扮演 提交于 2020-08-26 10:32:06

问题


I am trying to upload a file from an application to S3.

and i am getting the below error

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.

I have configured the CROS policy as

<?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>

Am i missing anything. What else needs to be added to this?

来源:https://stackoverflow.com/questions/63112120/error-while-trying-to-upload-file-into-s3-no-access-control-allow-origin-head

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!