Route rules
A module declares how its pages are rendered and cached, by page pattern, in its dms.server.ts. A pattern is /x, /x/* (one segment below) or /x/** (the page and everything below).
server.registerRouteRules({
"/terms-of-use": { cache: { public: true, maxAge: 300, staleWhileRevalidate: 3600 } },
"/builder/**": { ssr: false },
"/reports/**": { headers: { "x-robots-tag": "noindex" } },
});
| Rule | Effect |
|---|---|
cache | Page documents and Inertia answers default to private, no-cache, since they carry the visitor's session. A public cache replaces it, with Vary: Cookie, only for a GET of a page the backend serves to anyone (publicAccess), answered 200 to a request without any cookie and without x-content-language: such an answer holds nobody's data. Any other request keeps the private default. cache: false keeps the default under a broader rule. |
ssr: false | A document request gets the client-rendered shell instead of a server render. Inertia visits are unchanged. |
headers | Added to the page's document and Inertia answers. cache-control, vary, set-cookie and the content and Inertia headers stay the server's. A value with a control character rejects the whole route rule, with a warning at startup. |
The frontend server stores nothing itself: a public cache rule is for a shared cache or a CDN in front of it.
Merging
The rules that match a page merge from the least to the most specific pattern. For one pattern, the highest-priority module's rule wins, with a warning. A rule never changes who may see a page: the backend checks access on every request.
Sessions and sign-in
The auth hooks the module that owns sign-in registers, how page props and the interface language follow the session, and how a module flow opens a session through /auth/establish.
Supported releases
Declare the @antelopejs/dms-frontend releases a module runs on, and what the CLI does with that range.