Harthelm Docs
Guides

Path routing and split traffic

Several routes per domain, and several workspaces behind one route.

Last updated 2026-10-19

A custom domain can send different paths to different workspaces, and split the visitors of one path between several workspaces. Changing routes needs the team Admin role.

Several routes

Routes are checked in order, and the first match wins. A path matches itself and everything below it: /blog serves /blog and /blog/post, not /blogs. Put the more specific paths first and / last.

Terminal
hart domain route shop.example.com /api=124 /blog=125 /=123
RequestGoes to
/api/ordersworkspace 124
/blog/helloworkspace 125
/, /cartworkspace 123

In the console, the Routing tab lists the routes in order; the arrows move a route up or down. Click Save routes when you are done.

The path reaches the workspace unchanged: workspace 124 gets /api/orders, not /orders. Inside the workspace, the dev URL's own routes then send it to a service, where strip can remove the prefix.

hart domain route replaces all routes with the ones you give. Run it without routes to see the current ones first.

Split traffic

Several workspaces on one route split the visitors evenly. Each visitor stays with their workspace for 24 hours.

Terminal
hart domain route shop.example.com /=123,126

Use it for:

  • A/B tests: two variants of the app, half of the visitors each.
  • Blue/green switches: prepare the new version in a second workspace, add it next to the old one, then remove the old one. To switch a site over at once, replace the route's workspace.

Each workspace must be running its landscape; a sleeping one wakes on the first request it gets.

Regular expressions

Paths are regular expressions under Access and limits (or hart domain set --regex) matches request paths with RE2 expressions instead of prefixes. Expressions are anchored at the start of the path; the first that matches wins. Lookahead and back references are not supported, and routes that do not fit the new kind are refused when you switch.

Terminal
hart domain set shop.example.com --regex

Take a domain off the air

Terminal
hart domain route shop.example.com --clear

Without routes, the domain answers nothing; it stays verified and keeps its certificate.

Next steps

On this page