martinklepsch / s3-beam

🚀 direct-to-S3 uploading using ClojureScript
Eclipse Public License 1.0
92 stars 17 forks source link

Switch to using virtual-host style URLs when possible #49

Open danielcompton opened 4 years ago

danielcompton commented 4 years ago

Currently, s3-beam uses https://s3-<region>.amazonaws.com/<bucket> as the upload URL path (path-style). It is also possible to upload to https://<bucket>.s3-<region>.amazonaws.com (virtual-host style).

AWS is planning to deprecate path-style addressing for buckets created after September 30, 2020. There are also performance and resilience benefits for switching to virtual-host style addressing for existing buckets.

The switch is transparent for many buckets, but is not for buckets with a . in the bucket name (among others). AWS doesn't currently create a valid certificate for these buckets, so you will get TLS errors when you try to upload/download from them.

Using #38 would fix this for us, as it defaults to using virtual-host style addressing, unless the bucket has a . in it.

In the meantime, you can use the upload-url parameter to s3-sign to override the upload URL.

danielcompton commented 4 years ago

Also, from Working with Amazon S3 Buckets:

In a virtual-hosted–style URL, the bucket name is part of the domain name in the URL. For example:

  • http://bucket.s3-aws-region.amazonaws.com
  • http://bucket.s3.amazonaws.com Note Buckets created in Regions launched after March 20, 2019 are not reachable via the https://bucket.s3.amazonaws.com naming scheme.