How do you set a default root object for subdirectories on a statically hosted website on Cloudfront? Specifically, I\'d like www.example.com/subdir/index.html
Another alternative to using lambda@edge is to use CloudFront's error pages. Set up a Custom Error Response to send all 403's to a specific file. Then add javascript to that file to append index.html to urls that end in a /. Sample code:
if ((window.location.href.endsWith("/") && !window.location.href.endsWith(".com/"))) {
window.location.href = window.location.href + "index.html";
}
else {
document.write("");
}