What is a Wildcard DNS record?
A wildcard DNS record is a record that answers DNS requests for any subdomain you haven't already defined. You can create wildcard A records and CNAME records by entering an asterisk (*) in the host field when creating a DNS record.
For example, if you create the wildcard A record *.goosehollow.design and someone visits https://abcdef.goosehollow.design, their request will resolve to the IP address you specified as the answer.
Here are a few things to keep in mind...
Wildcard records don't return for lookups of the root domain
Lookups for your root domain (the part of your domain after the "www.") won't return the wildcard record as you might expect. You'll need to add a matching root record (empty host field) or lookups will fail if your visitor omits the "www."
Wildcard records don't override existing records (such as CNAME records)
When you set a wildcard record, that record does not override any existing subdomain records in the zone (zone is another term for all the DNS records associated with your domain).
Here's an example:
Above is a CNAME record and a wildcard A record. If we do a "dig" command (asking the DNS for information) on a random subdomain, in this case "goodbye.etaoin.ink", we get the wildcard IP address.
If we "dig" the CNAME record (hello.etaoin.ink) we do not get the wildcard, but the established CNAME record IP address.
The wildcard picks up the random subdomains, excluding the one already defined by the CNAME record.
Here's another example:
The first A record is an example of a "www" A record. The second, a wildcard A record. The third, the root domain A record. If we "dig" the domain (etaoin.ink), we will see it shows the root domain's IP address.
If we ask for information on a subdomain, let's say "hello.etaoin.ink", we will see it shows the wildcard IP address.
If we ask for information on "www.etaoin.ink", we get the IP listed for the "www" A record, not the wildcard record.