I have the following situation:
- An S3 bucket with multiple path-based applications, grouped by version number. Simplified example:
/v1.0.0
index.html
main.js
/v1.1.0
index.html
main.js
- Each application is a (React) SPA and requires client-side routing (via React router)
I am using S3 with Cloudfront and have everything mostly working, however the client-side routing is broken. This is to say I am able to visit the root of each application, ie. https://<app>.cloudfront.net/<version>
, but cannot reach any client-side routes.
I'm aware that an error document can be set to redirect to an index.html
, but I believe this solution only works when there is one index.html
per bucket (ie. I cannot set an error document per route-based path).
What's the best way to get around this issue?