Reputation: 1435
I have a heroku app running from region europe
I can't upload an image in a form in my rails app (RoR 6) due to a same origin
policy at my amazon s3 bucket. That bucket is in eu-west-1
(Dublin - where I thought heroku also is)
Should I have put the bucket in France eu-west-3
since my domain is French?
This is my CORS file:
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>https://www.cremers.fr/adm/auteur/2/article/nouveau</AllowedOrigin>
<AllowedOrigin>https://www.cremers.fr/</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
Upvotes: 1
Views: 1271
Reputation: 1945
As per AWS
An Amazon S3 bucket name is globally unique, and the namespace is shared by all AWS accounts. This means that after a bucket is created, the name of that bucket cannot be used by another AWS account in any AWS Region until the bucket is deleted. You should not depend on specific bucket naming conventions for availability or security verification purposes.
Amazon S3 creates buckets in a Region you specify. To optimize latency, minimize costs, or address regulatory requirements, choose any AWS Region that is geographically close to you. For example, if you reside in Europe, you might find it advantageous to create buckets in the EU (Ireland) or EU (Frankfurt) Regions. For a list of Amazon S3 Regions, see Regions and Endpoints in the AWS General Reference.
So it depends on your application usage and region to choose S3 bucket region
Upvotes: 0
Reputation: 15298
You can use any region.
It has nothing to do with the domain.
You can at least us-east-2
or us-west-1
. It doesn't matter.
The only thing that may affect this is the download speed. If user is in France, then it will be a little longer to download from the Canadian server than from the European one.
But this can be neglected.
Upvotes: 2