I'm wondering if this is feasible. I'm thinking about serving a React app using s3 and Cloudfront.
Some of the routes are prerendered, and can be served as static index.html files. Other routes, on the other hand, need to be handled by client side routing.
What I want s3 to do is if somebody asks for a route that isn't prerendered, I would want to serve a default index.html file instead of 404. I don't want to return a redirect response, because the url needs to stay the same to be handled by client side routing.
Is it possible to do this with s3? Or maybe from Cloudfront, it there a way to detect a 404 response from s3 and return a default file?
By "routes" I mean urls. So there are some urls for which I want to serve an html file, and for all others, I want to serve a default html file. (If the request has text/html mimetype)