ERR_INSECURE_RESPONSE while accessing files from s3 bucket

763 views Asked by At

When I access image from S3 bucket using HTTPS I get error as, net::ERR_INSECURE_RESPONSE for s3 bucket.

I want to load image file using HTTPS only.
Below is the link of image file which I can access using HTTP but can not using HTTPS. https://bucket.leadient.s3.amazonaws.com/9/branding_image/585ce85fa788a.jpg

This is my CORS

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

I granteed all permissions for my user and only list for Everyone.

Why when I upload a picture, that picture is not shown on my website (net::ERR_INSECURE_RESPONSE)?
I have not set any policy for S3 bucket.

1

There are 1 answers

3
AndyPHP On BEST ANSWER

Finally, I found the answer myself.

The CORS settings were perfect and there is no need to set any policy for bucket.

The URL is wrong.
The proper URL is as below,
https://s3-us-west-2.amazonaws.com/bucket.leadient/9/branding_image/585ce85fa788a.jpg

First I searched for the region with which bucket is created and respective endpoint for that region.
My buckets region was US west (Oregon) and hence the endpoint became
s3-us-west-2.amazonaws.com.
And I placed my bucket.leadient after the endpoint and error resolved.
Link helped me
Amazon S3 ERR_INSECURE_RESPONSE on Laravel