I have a Angular App with a lot of routes, that run over a Express Server.
Since all routes are from the same one-page-application, I configured Express the return always the same index.html
for a bunch of routes, like /login
and /settings
. And I also have custom routes like /user/:userId
.
But since we remove our backend logic to a separated API, we plan to move our files into a Amazon CDN, CloudFront.
But the thing is, CDN works like directories, there is a way to configure CloudFront to point all request without extension to return the index.html
? Because that way all .js
and .css
would work nicely.
I appreciate any help! Thanks.
Update 1
I did some more digging into Aws, and apparently this is more a S3 configuration than CloudFront. But I still don't know how to do this.
Update 2
I already found the answer in this stack.
The solution is tricky, I just had to configure all 404 errors (403 in the case of S3) to redirect to the index.html
returning the status code 200, and all worked fine.