---
title: "Wildcard Subdomain"
slug: "wildcard-subdomain"
updated: 2025-06-08T11:54:52Z
published: 2025-06-08T11:54:52Z
stale: true
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwilt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Wildcard Subdomain

## Wildcard Subdomain

Use Wildcard Subdomain to apply host configuration settings across multiple subdomains. Instead of configuring a host for each individual subdomain, the Wildcard Subdomain feature makes it possible to create a single host configuration that covers all subdomains.

Note that this feature is not supported for HTTP routing.

### Allow All Subdomains

To set the Wildcard Subdomain rule, in the Add Host dialog, enter the *Host Domain* and enable *Wildcard Subdomain*.

![wildcardSubdomainInNewAddHostDialog.png](https://cdn.document360.io/fa039225-513b-46a1-ba78-a57a1f1cb7c6/Images/Documentation/wildcardSubdomainInNewAddHostDialog.png)

The host is displayed in the host list with the wildcard character.

![wildcardCharacter.png](https://cdn.document360.io/fa039225-513b-46a1-ba78-a57a1f1cb7c6/Images/Documentation/wildcardCharacter.png)

In this example, *Wildcard Subdomain* is enabled for *example.com*, allowing traffic for *a.example.com*, *b.example.com*, *c.example.com*, *d.e.f.example.com*, and so on. All rules and CDN behaviors configured for *example.com* will apply to all matching subdomains.

### Configure Custom Behavior for a Particular Subdomain

To configure different behavior for a particular subdomain, configure an additional site host for that subdomain. Explicit host names take precedence over Wildcard Subdomain.

In this example, although *d.example.com* is a subdomain of *example.com*, the CDN will not treat it as a match for *example.com* because *d.example.com* is explicitly defined as its own site host. As a result, requests to d.example.com are processed according to the host configuration settings defined for *d.example.com*.

![wiildcardSubdomainExplicit.png](https://cdn.document360.io/fa039225-513b-46a1-ba78-a57a1f1cb7c6/Images/Documentation/wiildcardSubdomainExplicit.png)

Note that in the host list, a host that enables the Wildcard Subdomain option displays the wildcard character. Explicitly defined hosts do not.

### Allow Some, But Not All Subdomains

By default, all Wildcard Subdomains are allowed. To allow only specified subdomains and not all subdomains, you can [configure a Client Request Access rule](https://docs.qwilt.com/docs/client-request-access) to create a match condition.

For example: ![HostSuffixMatchCRARexample1.png](https://cdn.document360.io/fa039225-513b-46a1-ba78-a57a1f1cb7c6/Images/Documentation/HostSuffixMatchCRARexample1.png)

The match condition in this example creates an allow list. Only the subdomains specified by the allow list are covered by Wildcard Subdomain. Requests coming from any other subdomain are redirected.

## Cache Keys

By default, when Wildcard Subdomain is enabled, all subdomains share a single cache key. Likewise, configuring a basic Cache Key Management rule results in shared cache keys across subdomains.

To produce a unique cache key for each subdomain, you can [configure an advanced Cache Key Management rule](https://docs.qwilt.com/docs/z-cache-key-management#advanced).

![advCacheKey1.png](https://cdn.document360.io/fa039225-513b-46a1-ba78-a57a1f1cb7c6/Images/Documentation/advCacheKey1.png)

- **Enable** the **Include Host Name** feature to include the hostname (`req.h.host`) in the cache key, creating distinct cache keys for each subdomain.
- **Disable** the **Include Host Name** feature to exclude the hostname from the cache key, so that subdomains share a single key.

In short, to create a unique cache key for each subdomain, configure an advanced cache key rule with a MEL expression that includes the `req.h.host` element.

The MEL expression for a cache key, `req.h.host . '&amp;' . req.uri.path`, uses the entire request path and considers the request host header.

In this example, if your site configuration includes the wildcard subdomain, `*.example.com` , requests URLs for `1-example.com/path/to/file` and `2-example.com/path/to/file` would each generate a distinct cache key.

Or, to share a cache key across subdomains, exclude the hostname from the MEL expression: `'example.com&amp;' . req.uri.path`

In this example, requests to `1-example.com/path/to/file` and `2-example.com/path/to/file` would generate the same cache key.

[Cache Key Management](https://docs.qwilt.com/docs/z-cache-key-management)

## Site Certificate

Make sure to configure your site certificate in a way that covers all the hosts and wildcard subdomains.

You can achieve this by:

- Creating a wildcard certificate.
- Creating a multi domain certificate.

[Certificate Management](/v1/docs/certificate-management-1)

## Purge

When Wildcard Subdomain is enabled:

- Purge by Site  - covers all hosts and subdomains.
- Purge by Prefix - covers all hosts and subdomains.
- Purge by URL - covers the selected host and its subdomains.

[Purge](https://docs.qwilt.com/docs/understanding-the-purge-feature)

## SVTA Component: QW.AllowWildcardSubdomain

When you save the configuration version, the `QW.AllowWildcardSubdomain` component is added to the JSON configuration. This is a [private feature developed by Qwilt](https://api-docs.qwilt.cqloud.com/docs/CDN%20APIs/Sites%20API/Site%20Configuration%20JSON%20Format/prepare-the-configuration-json#qwilt-private-features).

```
{
   "generic-metadata-type": "MI.PrivateFeature.Qwilt.QW.AllowWildcardSubdomain",
   "generic-metadata-value": {
     "enable": true
  }
}
```
