Beta. The routing rules endpoints are new and their response shapes may
still change.
owner or manager role on the domain. Viewers get 403 forbidden.
Programmatic (API key) access requires the Pro plan and above — requests
from Starter accounts return
403 plan_upgrade_required.Request
Headers
Path Parameters
Body Parameters
Leading and trailing whitespace is trimmed from
sourcePath, targetUrl, and notes. Paths and URLs can be up to 2,048 characters.
Source path patterns
Matching ignores letter case and a trailing slash, so/About and /about/ both match a /about rule.
:name*, :name+, and a capturing * only work as the last segment of the pattern.
Each domain can have only one rule per sourcePath. Creating a second rule with the same path returns 409.
Targets
Redirects accept either a path on your domain (/new-page) or a full http:// / https:// URL (https://other-site.com/page).
You can reuse what the source matched:
- Captures: put a
:nameor*from the source into the target to insert what it matched. For example,/old-blog/:slug→/blog/:slugsends/old-blog/helloto/blog/hello, and/:path*/→/:path*strips the trailing slash from any URL. - Wildcards without captures: if the source ends in
/*and the target has no*, the rest of the path is appended to the target. For example,/old-blog/*→/blogsends/old-blog/2024/helloto/blog/2024/hello.
?.
Proxies need a full http:// or https:// URL. For security, a proxy target can’t be:
localhostor a private, internal, or link-local IP address (such as10.x.x.x,192.168.x.x, or169.254.169.254)- a
.internalor.localhostname - your own domain, or its
www.variant, since that would loop forever
/functions/v1/* → https://xyz.supabase.co/functions/v1 forwards /functions/v1/sitemap to https://xyz.supabase.co/functions/v1/sitemap.
How rules are matched
For each request, active rules are checked in this order, and the first match wins:- Higher
priorityfirst. - For the same priority, exact paths before patterns.
- Then longer source paths before shorter ones.
/blog/featured is checked before /blog/* automatically. Raise priority when you need a rule to win outright, like a broad catch-all that should override more specific paths.
A redirect whose target would be the same URL the visitor asked for is skipped, so a pattern like /:path*/ can’t cause a redirect loop.
Example Request
Response
Success (201)
TheLocation response header holds the new rule’s URL, /functions/v1/domains/{domainId}/routing-rules/{ruleId}.
The rule is always saved when you get a
201. If cacheInvalidated is
false, Hado SEO couldn’t refresh your domain’s cached settings right away,
so the rule may take a few minutes to start applying. You don’t need to
retry.Error Responses
The rule limit follows the plan of the person who owns the domain. If a
Starter account shared the domain with you, its Starter limit applies even if
your own plan is unlimited.