Skip to content

Domains and routes

A site or API Worker answers at <name>.yourfreesite.com from the moment it’s made, over HTTPS. Before its first deploy, the address shows a Not deployed yet page. The name is the Worker’s own, so it can’t change; a new address means a new Worker.

Add a domain in Sites › Domains, or with POST /api/v1/domains, in one of two ways:

Full setup Custom hostname
For A whole domain, such as brightwave.com A domain or subdomain whose DNS stays where it is, such as shop.brightwave.com
You do Set the two nameservers Digize gives you at your registrar. Digize copies your existing DNS records first. Add a CNAME and two TXT records (ownership and certificate) at your DNS provider.
Then Edit the domain’s DNS on its DNS records tab, and use Sites › Email routing with it. Keep managing DNS at your provider.

Digize checks a new domain every 10 minutes for up to two days, or straight away with Check now (POST /api/v1/domains/{hostname}/check). A domain is claimed for one workspace: one that another workspace has added can’t be added again.

Connect a domain to a Worker in Sites › Domains (the Worker’s Triggers tab links there) or with PUT /api/v1/domains/{hostname}/worker, while it’s still pending or later. The Worker answers on it once the domain is active. On full setup, connecting replaces the A, AAAA and CNAME records at the domain’s root with what serves the site. Make primary (POST /api/v1/domains/{hostname}/primary) makes a domain the address the Worker is shown with; every connected hostname keeps serving the same site, and none of them redirects to another.

A route runs a Worker on a path of another Worker’s hostname. With shop.yourfreesite.com/api/* as a route of an api Worker, /api and everything under it on shop.yourfreesite.com runs api, and every other path runs shop. The second Worker can be any of the workspace’s site or API Workers, on any of its hostnames.

Add routes on the Worker’s Triggers tab under Domains and routes, or with routes in PUT /api/v1/sites/{site}/triggers:

Terminal window
curl -X PUT https://digize.com/api/v1/sites/api/triggers \
-H "x-api-key: $DIGIZE_API_KEY" \
-H "content-type: application/json" \
-d '{"routes":["shop.yourfreesite.com/api/*"]}'
  • A route is a hostname, then a path ending in *. The path must not be empty: a route can’t take over a whole hostname.
  • The hostname must be one of the workspace’s, and not one of the Worker’s own.
  • A path matches whole segments: /api takes /api and /api/orders, never /apis. When several routes match, the longest wins.
  • The Worker sees the request’s full URL, prefix included, and its platform calls are made as the routed Worker.
  • A Worker can have up to 20 routes. routes replaces the whole list; leave it out to keep the list and change only crons.

routes in wrangler.jsonc aren’t read.