AWS S3 Access-Control-Allow-Origin Header

756 views Asked by At

Im using slim image cropper and Im saving the cropped image to S3, While storing i get Access-Control-Allow-Origin Header..Also i find the issue is not frequent.

for every "ten" s3 request, i find the error pop up once (this is approx)

my cros setting is as follows

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

also i tried adding policy as

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

but still could not solve.

I found there is no header information from s3 regarding access control. Is there a better way of getting the image with the header.

my bucket policy is

{
"Version": "2012-10-17",
"Id": "Policy1483356111760",
"Statement": [
    {
        "Sid": "Stmt1483356411157",
        "Effect": "Allow",
        "Principal": "*",
        "Action": "s3:GetObject",
        "Resource": "arn:aws:s3:::wed2wed2test/*"
    }
]
}

exact error message

XMLHttpRequest cannot load https://console.aws.amazon.com/s3/loginPortal?lpru=https%3A%2F%2Fs3-console-us-standard.console.aws.amazon.com%2Fs3%2Fcws%2FTattle%3F&lpa=Login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s3-console-us-standard.console.aws.amazon.com' is therefore not allowed access.

Any help would be much appreciated

0

There are 0 answers