简体   繁体   中英

AWS S3 Redirect only works on bucket as a subdomain not bucket as a directory

Many people have received 100s of links to PoCs that are on an internal facing bucket and the links are in this structure.

https://s3.amazonaws.com/bucket_name/

I added a redirect using AWS's Static website hosting section in Properties and it ONLY redirects when the domain is formatted like this:

https://bucket_name.s3-website-us-east-1.amazonaws.com

Is this a bug with S3?

For now, how do I make it redirect using both types of links? My current workaround is to add a meta redirect tag in each html file.

The s3-website is the only endpoint that supports redirects unfortunately. Using the s3.amazonaws.com supposes that you will be using S3 as a storage layer, instead of a website. If the link is to a specific object, you can place an HTML file at that url with a JS redirect, but other than that there is really no way to achieve what you are trying to do.

In the future, i would recommend always setting up a Cloudfront distribution for those kinds of usecases, as that will allow you to change the origin later on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM