I'm using S3 to host a JavaScript application that will use HTML5 PushStates. The problem is that if the user bookmarks any URL, it won't resolve to anything. What I need is to be able to accept all url requests and serve the root index.html in my S3 bucket, rather than just do a full redirect. My JavaScript application can then parse the URL and serve the correct page.
Is there a way to tell S3 to serve index.html for all URL requests instead of redirecting? This is similar to setting up apache to handle all incoming requests by serving a single index.html, as shown in this example: https://stackoverflow.com/a/10647521/1762614. I'd really like to avoid running a webserver just to handle these routes. It's very tempting to do everything from S3.
P粉2311124372023-10-16 19:14:41
With the help of CloudFront, this problem can be easily solved without URL hack.