Adding wildcard DNS record is taking precedence over regular CNAME records

I have multiple subdomains that are CNAME records that point to a single A record. I do this to serve multiple websites on a single IP with a reverse proxy. For example, a,example,com will be my A record:

z,example,com CNAME → a,example,com
y,example,com CNAME → a,example,com

I also have subdomains that forward to a different domain:

example,com CNAME → b,example,com
x,example,com CNAME → b,example,com
w,example,com CNAME → b,example,com

When I add a wildcard CNAME record:

*,example,com CNAME → b,example,com

y,example,com starts to forward to b.example.com. Cloudflare’s logs keep telling me that it keeps picking up example,com without a subdomain. My understanding of wildcards was that they were a “catch-all” if no other records were found to match, but that’s not what’s going on here. Spelling is correct, I’ve checked about 100 times over the past 3 hours.

The weird part is that everything works if I take off the cloudflare proxy for y.example.com, so I know the DNS is valid but it seems like there’s something going on with cloudflare.

NOTE: I had to use commas instead of periods in the domain names because cloudflare limits the amount of links allowed in a single post

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.

Hi Tyler,

From our support documentation:


Does Cloudflare support wildcard DNS entries?

Cloudflare supports the wildcard ‘*’ record for DNS management in all customer plans. Enterprise customers get full proxy support for wildcard records.

Free, Pro and Business plans

Cloudflare does not proxy wildcard records; therefore, wildcard subdomains are served directly without any Cloudflare performance, security, or apps. As a result, Wildcard domains get no cloud (orange or grey) in the Cloudflare DNS app. If you are adding a * CNAME or A Record, you need to make sure the record is grey clouded in order for the record to be created.

To get Cloudflare protection on a wildcard subdomain (for example: www), you need to define that record explicitly in your Cloudflare DNS settings. First, log into your Cloudflare account and click the DNSapp. In this example, you would add “www” as its own CNAME record on your Cloudflare DNS settings and toggle the cloud to orange so the Cloudflare’s proxy is enabled.

Cloudflare Enterprise customers can proxy wildcard records. To learn more about the Enterprise plan, contact us.

Wildcards are only valid in the left-most subdomain label. For example, it’s not possible to add sub.*.example.com, but it’s possible to add *.sub.example.com.


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.