My current setup is that www.domain.com serves an S3-hosted static website via CloudFront, so www.domain.com CNAME points to the CloudFront distribution, which in turn points to the S3 static website URL. The CloudFront distribution has www.domain.com
as an Alternate Domain Name set up.
I'd like to use Route53's Geolocation feature to route requests from North America to the current CloudFront (A), while all other requests go to another CloudFront (B) hosting another S3 static website. Since I can't add www.domain.com
as an Alternate Domain Name for two CloudFront distributions, I'm using the wildcard *.domain.com
instead for CloudFront A.
The wildcard works, and e.g. eu.domain.com
I set up serves the CloudFront B site correctly.
I've set up the Geolocation rules correctly in Route53, and dig
returns the correct CloudFront endpoint. Likewise, Route53 web testbench gives the correct endpoints depending on the IP location. However, curl
and web browsers give the wrong content – i.e. CloudFront A even though I'm in the EU.
Is there something wrong in my configuration? Is there a silent failover on the DNS level to the A distribution for some reason? Or some nasty cache? Can this be done at all? Thanks!