How does Route53 give priority to wildcard subdomains?
I currently have the following subdomains on my Route53:
website.com
=> elb1
dashboard.website.com
=> elb1
staging.website.com
=> elb2
cdn.website.com
=> cloudfront
I'd like to add a wildcard subdomain for a new feature that would match any subdomain and point the same elb, like this:
*.website.com
=> elb1
I've added it and it seems to work, but now I'm wondering, how does it give priority if the user navigates to staging.website.com
-- will it match *.website.com
or staging.website.com
first? And should I do anything differently?
Solution 1:
DNS will always match the most specific record first. In your case, the wildcard record will act as a fallthrough, catching any requests that don't match the non-wildcard records.