I am trying to deploy an Angular app, which is essentially a web-site client that makes API calls to a backend server and then display the data.
I tried using S3 static hosting for hosting this site by uploading the production build dist
folder generated by ng build --prod
.
The S3 static hosting seems to work fine with all the functionalities even though the Angular app seems to be a dynamic site. I was aware that Angular build can transpile the app to static assets.
However, I run into problems when I try to add AWS Cloudfront on top of the S3 static hosting. In particular, when accessing the site via Cloudfront, the site is unable to display data fetched from the backend server.
Any reasons or solution to why the Cloudfront is acting differently than the S3? I think that Cloudfront and S3 are not designed to host dynamic site, but I am wondering why is it that the S3 static hosting by itself seems to work just fine.