Certificate and hostname priority
When a new certificate is created, Cloudflare first deploys the certificate and then serves it.
For any given hostname, Cloudflare uses the following order to determine which certificate (and associated TLS settings) to apply to that hostname:
-
Hostname specificity: A specific subdomain certificate (
www.example.com
) would take precedence over a wildcard certificate (*.example.com
) for requests towww.example.com
. -
Zone specificity: A specific subdomain certificate (
www.example.com
) would take precedence over a custom hostname certificate if the domain is active as a zone on Cloudflare. -
Certificate priority: If the hostname is the same, certain types of certificates take precedence over others.
Priority Certificate Type 1 Keyless SSL 2 Custom Legacy 3 Custom Modern 4 Custom Hostname (Cloudflare for SaaS) 5 Advanced 6 Advanced - Total TLS 7 Universal -
Certificate expiration: If the hostname and certificate type are the same, Cloudflare deploys the certificate with the latest expiration date.
Cloudflare uses the following order to determine the certificate and settings used during a TLS handshake:
- SNI match: Certificates and settings that match the SNI hostname exactly take precedence.
- SNI wildcard match: If there is not an exact match between the hostname and SNI hostname, Cloudflare uses certificates and settings that match an SNI wildcard.
- IP address: If no SNI is presented, Cloudflare uses certificate based on the IP address (the hostname can support TLS handshakes made without SNI).
When multiple proxied DNS records exist for a zone — usually with Cloudflare for SaaS — only one record can control the zone settings and associated origin server.
Cloudflare determines this priority in the following order (assuming each record exists and is proxied (orange-clouded)):
-
Exact hostname match:
- New custom hostname (belonging to a SaaS provider)
- Legacy custom hostname (belonging to a SaaS provider)
- DNS (Belonging to the logical DNS zone)
-
Wildcard hostname match:
- DNS (Belonging to the logical DNS zone)
- New custom hostname (belonging to a SaaS provider)
If a hostname resource record is not proxied (gray-clouded) for a zone on Cloudflare, that zone's settings are not applied and any settings configured at the associated origin are applied instead. This origin could be another zone on Cloudflare or any other server.
Customer1 uses Cloudflare as authoritative DNS for the zone shop.example.com
. Customer2 is a SaaS provider that creates and successfully verifies the new custom hostname shop.example.com
. Afterward, traffic starts routing over Customer2's zone:
- If Customer1 wants to regain control of their zone, Customer1 contacts Customer2 and requests them to delete the custom hostname record. Another possibility is to stop proxying (gray-cloud) the record.
- If Customer1 is already proxying a new custom hostname for
www.example.com
, Customer2 creates and verifieswww.example.com
so traffic starts routing over Customer2's zone. Since this new custom hostname is the last one validated, the new custom hostname on Customer1's zone enters a moved status. - If Customer1 is already proxying a legacy custom hostname for
www.example.com
and Customer2 creates and verifies a new wildcard custom hostname for*.example.com
, traffic is routed to Customer1's zone while thewww.example.com
CNAME points to Customer1.
A customer has a proxied DNS record for their domain. The customer's zone on Cloudflare is using a Free plan.
This customer is also using a SaaS provider that utilizes Cloudflare for SaaS. The SaaS provider is using a Cloudflare Enterprise plan.
If the provider is using a wildcard custom hostname, then the original customer's plan limits will take precedence over the provider's plan limits (Cloudflare will treat the zone as a Free zone). To apply the Enterprise limits through Cloudflare for SaaS, the original customer's zone would need to either use a DNS-only record or the SaaS provider would need to use an exact hostname match.