Match subdomains with a wildcard record
Answer every subdomain that has no record of its own with one Edge DNS wildcard record, from Azion Console, the Azion CLI, or the API.
You can add a wildcard record to a zone in Edge DNS from Azion Console, the Azion CLI, or the Azion API. The record below answers 192.0.2.31 for every name of example.com that has no record of its own. To answer one named host instead, refer to Add, edit, or delete a record.
Select your interface once. The prerequisites and the procedure below show only that path.
Prerequisites
- A zone in Edge DNS for your domain. To create one, refer to Create, edit, or delete a zone.
- The Edit Edge DNS permission. Refer to Teams permissions.
digon your machine, to check the answer. To install it, refer to Query a zone with dig.
- Access to Azion Console. To sign in, refer to Access Azion Console.
Add a wildcard record
A record named * answers every name of the zone that has no record of its own, however many labels deep. To answer only the names under one label, such as apps, name the record *.apps instead. Use your own domain wherever this page shows example.com.
To add the wildcard record with the Azion CLI, replace <zone-id> with the ID of your zone. Quote the asterisk so your shell passes it unchanged:
The command prints the ID of the record:
The zone holds the wildcard record. Never include the domain in --name: Edge DNS adds it.
A name with its own record keeps its own answer: if the zone holds an A record for www, a query for www.example.com returns that record, not 192.0.2.31. For which names a wildcard matches and which it does not, refer to Record types.
Check the answer
Ask Azion’s nameserver directly, without your resolver’s cache, for a name that has no record of its own.
To query ns1.aziondns.net for a name with no record, such as ghost, run:
The nameserver returns the value of the wildcard record:
The wildcard answers for ghost.example.com. If the command prints nothing, refer to A new record returns NXDOMAIN.