Hostname management
Hostname management controls where your Turnstile widgets can be used by specifying which domains are authorized to load and execute your widgets. This security measure prevents unauthorized use of your widgets on domains that you do not control.
You can associate hostnames with your widget to control where it can be used via Hostname Management. Managing your hostnames ensures that Turnstile works seamlessly with your setup, whether you add standalone hostnames or leverage zones registered to your Cloudflare account.
By default, every widget requires at least one hostname to be configured. You cannot create a widget without specifying at least one authorized hostname.
When adding hostnames, follow these requirements:
- The hostname must be fully qualified domain names (FQDNs):
example.comorsubdomain.example.com - Wildcard characters (such as
*) are not supported in the hostname field. However, adding a hostname automatically authorizes all of its subdomains.
When you add a hostname, the widget will work on that exact hostname and all of its subdomains. This means adding a root domain covers all subdomains beneath it, while adding a specific subdomain restricts the widget to only that subdomain and its children.
Adding example.com as a hostname will allow the widget to work on:
example.comwww.example.comshop.example.comany.sub.example.com
Adding www.example.com as a hostname provides more restrictive control. The widget will work on:
www.example.comabc.www.example.com(subdomains of the specified hostname)
However, it will not work on:
example.com(parent domain)dash.example.com(sibling subdomain)cloudflare.com(unrelated domain)
Existing widget
-
In the Cloudflare dashboard, go to the Turnstile page.
Go to Turnstile -
Select an existing widget.
-
Go to Settings.
-
Under Hostname Management, select Add Hostnames.
-
Add a custom hostname or choose from an existing hostname.
-
Select Add.
New widget
-
In the Cloudflare dashboard, go to the Turnstile page.
Go to Turnstile -
Select Add widget.
-
In the hostname field, enter your domain(s).
-
If you have zones registered with Cloudflare, you can select from existing zones
curl -X PUT "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/challenges/widgets/$WIDGET_ID" \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "domains": ["example.com", "app.example.com", "api.example.com"] }'Free users are entitled to a maximum of 10 hostnames per widget.
Enterprise customers can have up to 200 hostnames per widget.