TenanciTenanci

Help centerRoutes, headers & scripts

Blocked paths

Stop parts of your app (admin panel, test version, sensitive files) from being opened through your customers' domains, project-wide or per domain.

Not everything in your app belongs on the customer's domain. With blocked paths, the edge refuses the address with a 403 error before it ever reaches the origin: the admin panel, the test version or an internal area become unreachable through white-label domains, while they keep working on the app's original address.

How it works

  • A block covers the path and everything that starts with it: /admin blocks /admin, /admin/users and also /administrator;
  • case and encoding tricks don't get through: /ADMIN, /%61dmin and //admin are blocked too;
  • a trailing * is just cosmetic (/internal/* is the same as /internal), and a trailing slash changes nothing either;
  • the block also applies to route destinations: a route never leads to a blocked path;
  • whoever tries to open it sees a neutral 403 page, with no details about your app.

You can't block / (that would be the whole site). To take a domain offline temporarily, use maintenance mode in Access.

Project and domain

Blocked paths add up: the project's apply to every domain, and each domain can add its own. (Unlike routes, headers and scripts, a domain doesn't replace the project's list here.)

Where Applies to
Project, Customization tab → Blocked paths Every domain in the project
Domain, Settings tab → Blocked paths card This domain only, on top of the project's (shown under From project:)

Blocking a path

  1. Open the project and go to the Customization tab;
  2. Open the Blocked paths tab;
  3. Type the path in the field (e.g. /admin) and click Add. Repeat for each path;
  4. Click Save. The list takes effect within seconds on every domain.

For a single domain, do the same in the Blocked paths card on the domain's Settings tab. To unblock, click the × next to the path and then Save.

Limits: up to 100 paths in the project and 100 on each domain, up to 200 characters each and without spaces.

Via the API

The list is the blockedPaths field of the project (PATCH /projects/:id) and of the domain (PATCH /domains/:id). What you send replaces that level's whole list; send [] to clear it.

curl -X PATCH https://api.tenanci.com/v2/projects/prj_8f3k2m \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"blockedPaths":["/version-test","/admin"]}'
curl -X PATCH https://api.tenanci.com/v2/domains/dom_4h7n1q \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"blockedPaths":["/franchising"]}'

A path without a leading / gets one automatically. An invalid path (just /, with spaces or longer than 200 characters) returns 400 invalid_blocked_path, and a list with more than 100 items is also rejected with 400.