Wildcard Subdomain
  • 17 Dec 2024
  • 3 Minutes to read
  • PDF

Wildcard Subdomain

  • PDF

Article summary

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.

addHostWildcardSubdomain.png

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

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

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 to create a match condition.

For example:
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.

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 . '&' . 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&' . 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

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

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

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. In the JSON format, private features are nested within the MI.PrivateFeaturesList object, in the "generic-metadata-value" "features" field.

SVTAwildcardSubdomain.png


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.