Search code examples
amazon-web-servicesamazon-s3subdomain

Custom Domain for S3 Files


This should be easy as there is no shortage of pages on custom domains and S3 but for some reason I can't seem to get it to work as expected.

I have a S3 Bucket full of videos. The S3 bucket is called for example "videos.foo.com". I bought the domain "videos.foo.com" and set it up in cloudflare with the cname "videos.foo.com" pointing to "videos.foo.com.s3-website-us-east-1.amazonaws.com".

I can view files in my bucket by going to there full url such as "videos.foo.com.s3-website-us-east-1.amazonaws.com/myvideo.mpg".

My problem is I can't view them by going to "videos.foo.com/myvideo.mpg".

I tried enabling "Redirect all requests to another host name" and entering "videos.foo.com" but that didn't work either. To note, I will 'not' be hosting a site at "videos.foo.com" just serving files.

All the files have permissions everyone: open/download.

If anything sees the error in my ways please let me know. In the mean time I'll keep searching and going through trial and error. Thanks!


Solution

  • Nginx S3 proxy helps to solve that problem, please check more details: https://stackoverflow.com/a/44749584/290338

    A bucket can be named differently, the only performance rule is to have EC2 and a bucket in the same geo location.