Support >
  About cybersecurity >
  How do you set the TTL for DNS wildcard records? Unlike standard records, this involves balancing query load against the need for rapid failover.

How do you set the TTL for DNS wildcard records? Unlike standard records, this involves balancing query load against the need for rapid failover.

Time : 2026-12-06 10:48:32
Edit : DNS.COM

When configuring wildcard DNS records (`*.example.com`), many webmasters and SaaS operations engineers simply apply the same TTL (Time-to-Live) settings used for standard A or CNAME records—a decision that often leads to significant trouble. If the TTL is set too long, traffic may remain routed to a failed node for an extended period; conversely, setting it as low as 60 seconds can trigger a flood of requests back to the authoritative DNS server—often driven by automated scans of random subdomains—potentially overwhelming the system. While the underlying logic for wildcard DNS TTLs is the same as that for specific subdomain records, the scope of impact is exponentially larger. Every TTL value must carefully balance performance, cost, security, and disaster recovery. In this guide, we will clarify the nuances of wildcard DNS TTLs, provide recommended values ​​for various scenarios, outline operational best practices, and highlight often-overlooked risks.

First, it is essential to understand a fundamental concept: a wildcard DNS record has its own independent TTL; it does not automatically inherit the TTL from specific records like `@` or `www`. The core principle remains the same—recursive DNS servers cache the result for the duration of the TTL. During this period, any query for an otherwise undefined subdomain that matches the wildcard pattern will be served from the cache, avoiding the need to query the authoritative DNS server again. The critical difference, however, is that while a standard record corresponds to a single, specific subdomain, a wildcard record handles queries for an infinite number of potential subdomains. These can be triggered by web crawlers, security scanners, or even simple user typos. This is what makes the TTL for wildcard records unique: for any given TTL value, a wildcard record generates a significantly higher query load than a standard, specific DNS record.

Consider this practical example: if you set a TTL of 60 seconds for a `www` A record, it might receive a few thousand queries per day. If you enable a wildcard record, however, a barrage of probes for random subdomains will continuously trigger queries. A short TTL causes the cache to expire rapidly, forcing constant requests back to the authoritative DNS server. This can increase the query volume by tens or even hundreds of times—not only exhausting your DNS service plan’s query quota but potentially triggering rate-limiting by your DNS provider, increasing resolution latency, or even creating a risk of DNS amplification attacks. Therefore, when it comes to the TTL for wildcard DNS records, one should not blindly assume that "shorter is always better." Below are recommended TTL (Time-to-Live) settings for wildcard DNS records across various business scenarios—standard practices for cross-border SaaS platforms, testing environments, and "fallback" (catch-all) redirection setups.

Scenario 1: Production SaaS (multi-tenant) and store-specific subdomain systems (the most common use case). A TTL of 300 seconds (5 minutes) is recommended. This offers the best balance between performance and cost-efficiency. It allows for effective cache reuse for most user requests, reducing the load on the authoritative DNS. In the event of a backend server or CDN node failure, the cache will expire within approximately 5 minutes, enabling a swift update to the DNS target and minimizing downtime. This is the preferred configuration for most operations teams managing SaaS platforms where customer subdomains are generated dynamically and rapid disaster-recovery switching is required. For platforms with extremely high traffic and query volumes, the TTL can be increased to 600 seconds (10 minutes) to further reduce the frequency of origin-server requests.

Scenario 2: Wildcard DNS used solely for "fallback" redirection (e.g., redirecting users who enter an incorrect subdomain to the main website homepage). A TTL of 3600 seconds (1 hour) is recommended; it is generally advised not to exceed 86,400 seconds (24 hours). In this scenario, the DNS target rarely changes, so a longer TTL maximizes caching and minimizes unnecessary queries. However, setting a TTL as long as 24 hours is not recommended; wildcard records carry a risk of "subdomain takeover." If the target resource becomes compromised or invalid, an excessively long TTL would cause the malicious DNS mapping to persist in caches across the internet, significantly delaying the window for security remediation.

Scenario 3: Development, testing, and pre-production environments. A TTL of 300 or 600 seconds is recommended. These environments often involve frequent backend address adjustments or server switching, requiring DNS changes to take effect quickly. However, since testing environments are frequently accessed by developers and automated scripts using a wide variety of random subdomains, a TTL as short as 60 seconds is generally not advised. During short-term windows—such as a "canary" (phased) migration or network routing switch—you may temporarily lower the TTL to 60–120 seconds; once the migration is complete and operations have stabilized, it should be promptly returned to 300 seconds or higher. Avoid maintaining an extremely short TTL for the long term. Method 4: Unified CDN access via wildcard CNAME records, with a TTL typically set between 300 and 600 seconds. By using a wildcard CNAME to point to the CDN, all traffic is routed through CDN nodes. Since the CDN provides its own caching layer, there is no need for an extremely short DNS TTL. Furthermore, a TTL of 5–10 minutes offers sufficient flexibility for CDN node switching or adjustments to origin-pull policies.

Below is a standard operational procedure for making changes to wildcard DNS records. Following this sequence is essential to prevent prolonged service disruptions:

Before a planned IP/CNAME switch, reduce the wildcard DNS TTL to 60–120 seconds (ideally half a day to a full day in advance).

Wait for all existing, longer-TTL cache entries to expire.

Update the target destination for the wildcard DNS record.

Verify that DNS resolution is functioning correctly across the network and that service access remains stable.

Restore the wildcard DNS TTL to its standard, day-to-day value (typically 300 seconds).

A common pitfall is attempting to adjust the TTL only after an incident has already occurred. By then, the old, long-TTL records are already cached in recursive DNS servers globally, making it difficult to propagate the changes quickly.

Here are four frequent misconceptions—and easily overlooked traps—regarding TTL settings for wildcard DNS records:

Misconception 1: Setting a wildcard DNS TTL to 60 seconds ensures "real-time" updates. This is incorrect. For one, some recursive DNS servers enforce a minimum cache duration, meaning they will not strictly refresh every 60 seconds. Additionally, a high volume of requests for various random subdomains can trigger frequent origin-pulls, leading to resolution timeouts and instability—issues that become more pronounced as traffic volume increases. A short TTL should be treated as a temporary measure, not a long-term production configuration.

Misconception 2: Wildcard DNS TTLs conflict with TTLs set for specific, explicit subdomains. They do not. Explicit subdomain records take precedence over wildcard records and utilize their own independent TTLs, meaning they do not interfere with one another. For example, if `api.example.com` has an A record with a TTL of 3600, while `*.example.com` has a TTL of 300, requests to `api.example.com` will follow its own specific cache settings, while requests to other, undefined subdomains will follow the wildcard cache settings—the two systems operate independently.

Misconception 3: It is acceptable to configure wildcard records for MX or TXT (e.g., SPF, DKIM) records with a short TTL. It is strongly advised against using wildcard records for email-related entries such as MX, SPF, or DKIM. DNS records used for email verification require extremely high cache stability. Relying on wildcard DNS records as a fallback can easily lead to email delivery failures or verification errors; therefore, all email-related records must be configured as precise, explicit records rather than being handled by wildcard entries.

A common misconception is that a larger TTL (Time-to-Live) value equates to greater security. While a longer TTL reduces query load, it also amplifies the impact of security incidents. For instance, if a third-party cloud resource—previously pointed to by a wildcard record—is released and subsequently hijacked via subdomain takeover, a longer TTL ensures that this malicious record persists across the network for a longer duration, thereby extending the exposure window for phishing attempts or malicious content.

To mitigate these risks, a comprehensive security strategy is essential. Since wildcard DNS is inherently high-risk, TTL management is only one piece of the puzzle. Regardless of your TTL settings, you should implement Host header validation, WAF rate limiting, and monitoring/alerting for subdomains. Additionally, regularly audit the backend resources linked to your wildcard records to prevent "dangling DNS" entries. Where possible, narrow the scope of your wildcard records: instead of applying a wildcard to the root domain (e.g., `*.example.com`), restrict it to a specific subdomain zone (e.g., `*.app.example.com`) to minimize the attack surface.

In summary, there is no "universal" TTL value for wildcard records. The core trade-off logic remains the same as for standard records; however, because wildcard records handle an infinite number of potential subdomain queries, they can significantly amplify query volume. For standard SaaS production environments, a TTL of 300 seconds is recommended. For stable fallback redirects, 3600 seconds is appropriate. During migration or transition windows, you may temporarily reduce the TTL to 60–120 seconds, reverting it once operations stabilize. Avoid using extremely short TTLs (e.g., 60 seconds) for long periods, and likewise, refrain from setting excessively long TTLs (e.g., 24 hours).

By choosing a professional, reliable authoritative DNS service—one that supports custom TTLs, query monitoring, and anomaly alerts—you can flexibly manage your wildcard DNS caching strategy. This allows you to maintain operational agility during transitions while controlling DNS query load and reducing the security risks associated with wildcard records, ensuring that services relying on dynamic subdomains remain stable and under your control.

DNS Anna
DNS Jade
DNS Amy
DNS NOC
Title
Email Address
Type
Information
Code
Submit