Home Control S3 Bucket Hosted Website's trailing slash redirects
Reply: 0

Control S3 Bucket Hosted Website's trailing slash redirects

user1078
1#
user1078 Published in May 23, 2018, 8:29 pm

Automated the deployment of static sites to S3 with Ansible - not using any of Ansible's built in tools, necessarily, just using the CLI and local commands.

It's been working really well, but one issue I can't shake is when creating redirects, visiting the redirect with a trailing slash gives a 404, because S3 looks to serve /redirect/index.html rather than following the redirect.

Redirects are created through the API:

aws s3api put-object 
  --acl public-read 
  --website-redirect-location "https://devicelab.org/" 
  --key html/book

...where 'html' is the folder configured to serve the website from, 'book' is the desired redirect, and the homepage is the desired destination.

Visiting https://devicelab.org/book behaves as expected. Visiting https://devicelab.org/book/ (note trailing slash) shows 404 page.

I've tried creating an additional object html/book/ (with trailing slash) but still get the 404.

How can I configure this behaviour / work around the issue?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310601 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO