Rewriting Amazon S3 static urls [closed]

2019-07-15 14:32发布

问题:

In the interest of hosting purely static sites from Amazon S3, is the only route to rewrite the URLs and endpoints for accessing it's resources in a friendlier way via a rewrite engine such as any web server? And would it best to host this as an EC2?

It seems overkill but wasn't sure if there were alternatives.

回答1:

I'm not sure why you need to rewrite.

You can assign a DNS CNAME to an S3 bucket for DNS. And they recently started supporting a default document.

So you can perfectly host http://www.example.com/ or http://www.example.com/some/path/to/some/file.html

http://aws.typepad.com/aws/2011/02/host-your-static-website-on-amazon-s3.html



回答2:

S3 offers no features to 'rewrite' URLs as keys are immutable.

If you want to use URLs that are different from the S3 key you'll have to proxy the requests yourself.