I'm using Laravel framework on my subdomain sub.example.com
trying to implement the connection with Amazon S3 for all the pictures of my website.
This is my Policy for my bucket (bucket-1
)
{
"Id": "Policy************",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt***********",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::bucket-1/*",
"Principal": "*"
}
]
}
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
)?
If I navigate to the url of the picture (https://s3.eu-west-1.amazonaws.com/bucket-1/...
) Chrome shows a warning page with the message Your connection is not private
s3.eu-west-1.amazonaws.com. NET::ERR_CERT_COMMON_NAME_INVALID
Subject: *.s3-eu-west-1.amazonaws.com
Issuer: DigiCert SHA2 High Assurance Server CA
The thing that makes me even more baffled is that if I copy paste the same link on another tab, I can see the picture without any problem.
You're using
s3.eu-west-1.amazonaws.com
, but you should be usings3-eu-west-1.amazonaws.com
... you want a dash instead of a dot after "s3."http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
Different regions in S3 have variations in their conventions, depending on age. What you did would have been valid in eu-central-1, which works both ways, but not in eu-west-1.