Cors政策不允许上传

Cors政策不允许上传

问题描述:

谁能告诉我我是否在这里错过了什么。

Can anyone tell me if i've missed something here. This has been added to the CORS policy in the relavent bucket.

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

但是,当我尝试执行XHR上传时,仍然会遇到跨域错误。

However, when I try to do an XHR upload i still get a cross domain error. Banging my head on the wall with this one!

只需尝试使用此功能即可。

Just try to use this. It should work

<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>PUT</AllowedMethod>
    <MaxAgeSeconds>3000</MaxAgeSeconds>
    <AllowedHeader>Content-Type</AllowedHeader>
    <AllowedHeader>x-amz-acl</AllowedHeader>
    <AllowedHeader>origin</AllowedHeader>
</CORSRule>