I’m deploying a SPA in a S3 bucket. I’m using cloudfront to work through https. I need to redirect or delete the www in my domain (example.com). I tried this process:
The result is that it’s not redirecting to the non-www bucket. What is happening is that its waiting to find index.html (configured in the default root object) of the www bucket and is thus not redirecting to the other bucket (the non www one)
Based on OP's feedback in the comment section, changing the CloudFront origin to use the website endpoint works.