Route53 only route single level on wildcard subdomain

0

We have a wildcard subdomain pointing at a load balancer, i.e. *.example.com. For a single level domain this is working as expected

However, Route53 will also route second and third level domains. For example, "second.first.example.com" will be routed through the *.example.com record. This is then incompatible with our SSL certificate.

Is there a way to prevent this and only route a single level of subdomain?

Thanks

James
asked 10 months ago1013 views
2 Answers
0

Hi.

As of now that is how Route53 handles wildcards, it will route for the subdomain and all the subdomain of the subdomain. However, specific domain names take precedence, so you could create specific records for the domains you don't want to route to the ALB.

From documentation: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DomainNameFormat.html

- The * must replace the entire label. For example, you can't specify *prod.example.com or prod*.example.com.

- Specific domain names take precedence. For example, if you create records for *.example.com and acme.example.com, Route 53 always responds to DNS queries for acme.example.com with the values in the acme.example.com record.

- The * applies to DNS queries for the subdomain level that includes the asterisk, and all the subdomains of that subdomain. For example, if you create a record named *.example.com, Route 53 uses the values in that record to respond to DNS queries for zenith.example.com, acme.zenith.example.com, and pinnacle.acme.zenith.example.com (if there are no records of any type for that hosted zone).
profile picture
EXPERT
answered 10 months ago
profile picture
EXPERT
reviewed 10 months ago
profile picture
EXPERT
reviewed 10 months ago
  • Plus on your ALB rules you could use a rule for host-header to limit what domains you will route to a target

0

Hi.Wildcard DNS domains are typically used to handle requests for non-existent domains or subdomains, and while the method shown by JimmyDQV seems valid all FQDNs you do not want routed must be explicitly specified. If this is not acceptable, you should consider whether the use of wildcard DNS domains is appropriate in the first place.

profile picture
EXPERT
answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions