asafdav / ng-s3upload

Upload to S3 using AngularJS
MIT License
190 stars 83 forks source link

Changed bucket URLs #59

Open soerface opened 9 years ago

soerface commented 9 years ago

Using the subdomain bucketname.s3.amazonaws.com causes issues with buckets containing a dot in their names. It makes browsers reject the issued SSL certificate. Therefore I propose using s3.amazonaws.com/bucketname to build all bucket URLs.

https://buck.et.s3.amazonaws.com/

https://s3.amazonaws.com/buck.et/

soerface commented 9 years ago

Ok, just saw that this creates another issue. Take a look at the AWS documentation: http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro

Using the path style access requires to use the correct subdomain for your AWS region, for example https://s3-eu-west-1.amazonaws.com/bucketname

What do you think about adding a new attribute awsRegion for the directive? If it is beeing set, the URL get's build with the given name concatenated, like

var s3Uri = 'https://s3-' + awsRegion + '.amazonaws.com/' + bucket + '/';
asafdav commented 9 years ago

Hi @swege, sorry for my very late response, I like your idea, can you please update your pull request accordingly ? I'll be happy to merge this. Thank you!