Within AWS I terminate TLS at an Application Load Balancer. I have configured a wildcard TLS certificate with AWS' Certificate Manager (ACM), e.g. *.example.com.
I have AWS Route 53 resolving *.example.com
, but I have nothing for *.*.example.com
as I have no need for this.
I know you can't configure wildcard certificates for multi-level domains such as *.*.example.com
.
https://x.example.com
is all good and responds with a valid certificate. I get a certificate error with https://y.x.example.com
, which makes sense. I have no need to serve multi-level subdomains such as *.*.example.com
.
I would like to be able to block all multi-level domain requests such as https://y.x.example.com
or just not have Route 53 resolving. Basically I want a Rule that says any host for https://*.*.example.com
return 404 or for the Host not to be resolved.
In the application load balancer I have 2 listeners port 80 and port 443.
I can configure a rule for the port 80 listener which works fine for http://x.y.example.com
and I can return a 404, when I configure the same rule for port 443 it does not work. Which I guess makes sense because the browser can't complete the TLS handshake.
If I complete an nslookup
for x.example.com
and y.x.example.com
I get the same NameServers, I won't have expected Route 53 to resolve y.x.example.com
.
So, I am looking for the answer to one of two questions:
- How does one configure AWS Load balancer to block all wildcard multi-level subdomains on Port 443?
- Why is Route 53 resolving
y.x.example.com
/ how to stop Route 53 resolving same?