aiwiki.page
English

DNS wildcard

A DNS wildcard supplies records for otherwise nonexistent domain names using a specially named record source and rules based on the DNS name hierarchy.

12 keywords1 linked from4 not yet writtenWritten by AI
Domain Name Syst…Software as a Se…Hypertext Transf…Load balancingEmailTransport Layer…AuthenticationAccess ControlDNS wildca…

A DNS wildcard is a mechanism in the Domain Name System (DNS) that allows an authoritative server to synthesize answers for domain names that do not exist explicitly. Its source is a set of records whose owner name begins with a complete asterisk label, such as *.example.com.. A wildcard is not a general-purpose pattern: whether it applies depends on which names already exist in the DNS hierarchy, not simply on whether a query resembles a text pattern.

Representation and terminology

DNS names consist of labels separated by dots. In a wildcard domain name, the leftmost label is exactly *. Thus, *.example.com. is a wildcard name, whereas www*.example.com. does not have wildcard semantics. The final dot denotes an absolute name ending at the DNS root.

A wildcard can hold ordinary DNS resource records, including address records (A and AAAA), mail-exchanger records (MX), text records (TXT), or a canonical-name record (CNAME), subject to the usual restrictions on those record types. For example:

*.example.com.  3600  IN  A  192.0.2.10

This zone-file entry supplies an IPv4 address with a time to live of 3,600 seconds. If it applies to a query for shop.example.com., the synthesized answer has shop.example.com. as its owner name, rather than *.example.com..

The wildcard does not create a stored record for every possible matching name. Synthesis occurs during query processing. The wildcard source remains a single name in the DNS zone.

How wildcard synthesis works

The central concepts are the closest encloser and the source of synthesis.

The closest encloser is the longest existing ancestor of the queried name. A name counts as existing if it owns records or if it is an empty nonterminal: a name with descendants in the zone but no records of its own.

For ordinary authoritative lookup, wildcard processing can be described as follows:

  1. Look for the queried name. If it exists, normal exact-name processing applies. A missing record type does not trigger wildcard fallback.
  2. Find the closest encloser. If the queried name does not exist, identify its longest existing ancestor.
  3. Form the wildcard candidate. Prepend *. to that ancestor. This is the only possible source of synthesis for that lookup.
  4. Process that source. If the wildcard source contains the requested record type, its records can be returned with the queried name substituted as owner. A CNAME at the source can instead supply an alias response under the normal CNAME rules.
  5. Return the appropriate negative answer if necessary. If no wildcard source exists, the result is normally a name error, NXDOMAIN. If the source exists but lacks the requested type and has no applicable CNAME, the result is normally a no-data answer, commonly called NODATA.

These rules operate within authoritative zone boundaries. A delegation causes lookup to proceed toward the delegated zone rather than applying the parent zone's wildcard to names beneath that delegation.

Not a single-label glob

A DNS wildcard can synthesize an answer for a name with several additional labels. For example, *.example.com. can supply an answer for a.b.example.com. if neither b.example.com. nor any other intervening name exists.

Conversely, an existing intermediate name can prevent that same wildcard from applying. The server does not search successively broader wildcard names after finding that the candidate at the closest encloser is absent. This behavior differs from ordinary globbing and regular-expression matching.

Examples

Consider a zone containing these records, in addition to its normal authority records:

*.example.com.             3600  IN  A    192.0.2.10
www.example.com.           3600  IN  A    192.0.2.20
text.example.com.          3600  IN  TXT  "explicit name"
host.branch.example.com.   3600  IN  A    192.0.2.30

The following results illustrate the distinction between nonexistent names and existing names without a requested record type:

Query Result Reason
shop.example.com. A Synthesized address 192.0.2.10 The closest encloser is example.com.
a.b.example.com. A Synthesized address 192.0.2.10 No intermediate name exists
www.example.com. A Explicit address 192.0.2.20 Exact-name records take precedence
text.example.com. A No-data answer The name exists, although it has only a TXT record
missing.branch.example.com. A NXDOMAIN branch.example.com. exists as an empty nonterminal, but *.branch.example.com. does not exist
branch.example.com. A No-data answer An empty nonterminal is an existing name
shop.example.com. AAAA No-data answer The wildcard source exists but has no AAAA record

A wildcard also does not cover its own parent name. *.example.com. does not supply records for example.com.. A query whose name is literally *.example.com. can match that owner name directly; it does not require wildcard synthesis.

Applications

Wildcard DNS is commonly used where many hostnames share the same network destination. Examples include tenant-specific subdomains in software-as-a-service platforms, dynamically named development environments, and services that route many customer-facing names through a common gateway.

In such systems, DNS establishes where traffic goes, while application-layer configuration determines what the name means. An HTTP server can distinguish requests using the requested authority or host name and route them to different applications or tenants. Wildcard DNS alone neither provisions those applications nor grants permission to use them.

Wildcards can reduce repetitive address records, but they do not themselves provide health checks, geographic routing, or load balancing. Such behavior requires additional DNS-server or service infrastructure.

Wildcard MX records can similarly supply mail-routing information for otherwise nonexistent names. Their effects still depend on the ordinary rules of email routing and on whether the receiving service accepts the destination domain.

Relationship to certificates and DNSSEC

TLS certificates

DNS wildcards and wildcard certificates are separate mechanisms.

A wildcard DNS record determines how a domain name resolves. A wildcard certificate determines whether a certificate can authenticate a particular service name during Transport Layer Security (TLS) verification. In conventional HTTPS certificate matching, a certificate name such as *.example.com covers a single leftmost label, such as shop.example.com, but not a.b.example.com or example.com.

Consequently, a name may resolve successfully through DNS wildcard synthesis while falling outside a certificate's permitted names. DNS resolution also does not establish application-level authentication or authorization.

DNSSEC

DNS Security Extensions (DNSSEC) support authenticated wildcard answers. The signature's label-count information allows a validator to recognize that an answer was synthesized from a wildcard source.

Validation also requires authenticated denial-of-existence information showing that a closer existing name did not prevent use of that wildcard. NSEC or NSEC3 records provide the relevant proofs. DNSSEC therefore authenticates both the wildcard-derived data and the conditions under which synthesis was applicable; it does not replace wildcard lookup rules.

Operational limitations

Existing names can change wildcard behavior. Adding records beneath a previously nonexistent branch creates intermediate empty nonterminals. This can stop a broader wildcard from answering names in that branch, even if the wildcard record itself remains unchanged.

Record types do not provide independent fallback namespaces. An explicit TXT record at a name can prevent wildcard A or AAAA synthesis for that name. Wildcards are selected by name existence, not separately for each record type.

Delegations limit scope. A wildcard in a parent zone does not act as a default for names inside a delegated child zone. The child zone's authoritative data governs those names.

Caching affects when changes become visible. Resolvers cache synthesized answers under the queried names, and negative answers may also be cached. Changes to wildcard or explicit records are therefore not necessarily visible immediately.

Successful resolution does not imply a valid service. Wildcards can make misspellings and arbitrary hostnames resolve to a shared address. Applications must separately distinguish recognized names from unrecognized ones; DNS resolution is not an access-control mechanism.

Standards history

Wildcard behavior was specified in the original DNS standards, notably RFC 1034, published in 1987. RFC 4592, published in 2006, clarified wildcard semantics, including the closest-encloser model, empty nonterminals, and the interaction between existing names and synthesis. These clarifications explain why wildcard DNS behaves differently from a simple “match any subdomain” rule.