Deploying front-end websites to S3 with CloudFront
ilhicas.com
ilhicas.com
If you don't want to run a build of your static site generator on your computer and upload the result to GitHub every time you make a change, you can just use Jekyll and GitHub will build it for you. I think GitLab supports other static site generators as well. This technique is how https://www.snazz.xyz works.
As it is, we have had to use BitBucket as the repo for our website, and we use the Pipelines feature on there to deploy to S3. Would be nice not to have to use a third party service to do something that AWS's own infrastructure makes unreasonably complex and difficult.
After all, they offer S3 as a service where we can deploy static sites, so why not in their pipeline service offer an S3 bucket as a valid destination for the code?
My BitBucket pipeline I described above has less than 10 lines of YAML to define which S3 bucket to push the committed changes to, so already, a 3rd party workaround is 10x less code than your 'AWS only' workaround. This shouldn't be the case.
(Of course, you can rewrite the URL on the fly via Lambda@Edge but that's a PITA to maintain)
CORS is only needed for the API, not the website, and only if you don't control the API or don't make it so the API can be served (from the client's perspective) from the same origin, perhaps because it's fronted by the same Cloudfront distribution.
Regardless, you can use extensionless links with your static website if you rename the file from login.html to login, then change the file metadata to Content-Type: 'text/html'
Here's a SO post https://stackoverflow.com/questions/51218979/react-router-do...
We have multiple React sites deployed this way to S3/Cloudfront with react-router and experience no issues.