Understanding DNS Wildcards
A DNS wildcard is a special record type that matches any subdomain not explicitly defined in your zone file. It is represented by an asterisk (*) in the hostname field. For example, if you have a wildcard A record pointing *.example.com to 192.0.2.1, then test.example.com, blog.example.com, and even randomname.example.com will all resolve to that IP address unless a more specific record exists for them.
This feature is incredibly useful during development or when managing many temporary subdomains, as it eliminates the need to create individual records for every new service. However, it can become problematic when moving servers, changing security policies, or decommissioning services. Leaving a wildcard in place after migration might cause old or unused subdomains to point to a non-existent or incorrect server, leading to broken links, security vulnerabilities, or unexpected traffic routing.
Locating Your DNS Management Interface
The first step in removing a wildcard is identifying where your domain’s DNS records are hosted. This could be at your domain registrar (like GoDaddy, Namecheap, or Cloudflare) or a dedicated DNS provider (like AWS Route 53, Google Cloud DNS, or Azure DNS). Log in to the account associated with your domain name.
Navigate to the section labeled "DNS Management," "Zone Editor," "Name Server Records," or similar terminology depending on your provider. Look for a list of existing records. You will typically see columns for Type (A, CNAME, MX, etc.), Host/Name, Value/Content, TTL, and Priority. Scan this list carefully for any entry where the Host or Name column contains only an asterisk (*) or sometimes @.* depending on the interface.
Deleting the Wildcard Record
Once you have located the wildcard record, proceed with caution. Deleting the wrong record can take down your entire website. Verify that the record type matches what you intend to remove. Most commonly, wildcards are A records for IPv4 addresses or AAAA records for IPv6. They can also be CNAME records, though less frequently due to RFC restrictions.
- Identify the Record: Find the row where the Host is
*. Check the Value column to confirm it points to the IP address you are trying to disassociate from subdomains. - Delete the Entry: Click the "Delete," "Remove," or trash icon associated with that specific record. Some providers require you to edit the record and clear the fields before saving, effectively deleting it. Others have a direct delete button.
- Confirm Action: A confirmation dialog will usually appear. Confirm that you want to permanently remove this DNS record.
If you have multiple wildcard records (e.g., one for A and one for CNAME), repeat this process for each type. Ensure you do not accidentally delete your root domain record (often denoted as @ or example.com), which is distinct from the wildcard subdomain record.
Handling Specific Subdomains
Before removing the wildcard, consider if you still need certain subdomains to function. If you have explicit records for www.example.com or mail.example.com, these will remain unaffected by the deletion of the * record. The wildcard only catches requests for subdomains that do not have their own specific entries.
If you plan to migrate specific services to new IPs, ensure those specific subdomains have their own A or CNAME records created and propagated before deleting the wildcard. Otherwise, they might temporarily fail to resolve if there is a gap in coverage. This approach allows for a controlled transition rather than a sudden blackout of previously working subdomains.
DNS Propagation and Verification
After deleting the record, changes do not happen instantly. DNS propagation relies on Time-To-Live (TTL) values set on previous records. Even if you delete the record, users with cached DNS data may still see the old IP address for a period ranging from minutes to 48 hours, depending on the previous TTL setting.
To verify the removal, use command-line tools like nslookup, dig, or online DNS checkers. Query a random subdomain that was previously covered by the wildcard, such as xyz123.example.com. If the wildcard is successfully removed and no other record exists for it, the query should return a "NXDOMAIN" error or indicate that the host does not exist. This confirms that the subdomain is no longer resolving to your server.
If you are experiencing issues with other DNS configurations, such as pointing subdomains to specific ports, you may find additional guidance in our guide on Pointing Subdomain DNS Record to Specific Port on Ubuntu VPS Server. Additionally, understanding how wildcards interact with other domains can help troubleshoot broader issues, as seen in our case study on Troubleshooting DNS Wildcard Domains: github.com Case Study.
Frequently Asked Questions
Will deleting the wildcard affect my main website?
No, deleting a wildcard subdomain record does not affect your root domain (e.g., example.com) or explicitly defined subdomains like www.example.com. These rely on separate, specific records that remain untouched.
How long does it take for the change to take effect?
The change is immediate on the authoritative DNS server, but global propagation depends on the TTL of the deleted record. Users may see stale data for up to 24-48 hours if they had cached the old record.
Can I restore the wildcard record later?
Yes, you can add a new wildcard record at any time through your DNS provider’s interface. Just ensure you select the correct record type (A, AAAA, or CNAME) and point it to the desired IP address.
What happens if I delete the wrong record?
If you delete your root A record, your website will go offline immediately. Always double-check the Host/Name column to ensure you are targeting the asterisk (*) and not the @ symbol or a specific subdomain name.
Do I need to restart my server after removing the DNS record?
No, DNS records are managed externally by your DNS provider. Deleting a record does not require any action on your web server or application server. The server continues to run normally; it just stops receiving traffic for unmatched subdomains.