Skip to main content

Performance, caching, limits and errors

Read this page before you take your website live.

Calling from the browser (CORS)​

Every path under /v2/public/cms/ returns Access-Control-Allow-Origin: * for every domain, so your website can call it directly from the browser, with no intermediate server.

Conditions:

  • Do not send cookies or credentials: use credentials: 'omit' (or the fetch default for cross-origin requests). The API does not allow credentials.
  • Do not add any headers (including Authorization, Content-Type or your own X-… headers). A GET request with no headers is a "simple request": the browser sends it directly, without an OPTIONS preflight. Adding a header adds a network round trip to every load.
  • Only the GET, HEAD and POST (for the view signal) methods.
  • The rate-limit headers (x-ratelimit-*) are not readable from JavaScript on cross-origin calls; only the 429 status code is.

Caching​

Successful responses of the three GET paths have:

Cache-Control: public, s-maxage=60, max-age=0, must-revalidate
  • The CDN keeps one copy per URL for at most 60 seconds. When staff save a change, the system actively purges the affected URLs from the CDN, so changes usually show up right away; 60 seconds is the maximum delay when the purge does not get through.
  • The browser does not reuse an old copy; it always asks again (the CDN answers quickly).
  • Error responses (4xx, 5xx) always have Cache-Control: private, no-store and are never stored.

The active purge only knows one way of writing a URL. For your site to pick up changes right away:

  • Write the parameters in exactly the order locale, category, tag, q, sort, page, limit, with no other parameters.
  • Always set locale explicitly, including for /site.
  • For lists, only page 1 is actively purged; later pages, and every search URL (q), may lag by up to 60 seconds.

Keeping a single way of writing URLs also lets all readers share one copy in the CDN.

Rate limits​

Limits are counted per caller address:

PathLimit
GET /site, GET /entries, GET /entries/{entrySlug}20 requests / 10 seconds, 50 requests / 10 seconds (shared), 120 requests / 60 seconds
POST /entries/{entrySlug}/view5 requests / 10 seconds, 30 requests / 60 seconds

Exceeding a limit returns 429 with errorCode: "RATE_LIMITED". Every response has the headers x-ratelimit-limit-*, x-ratelimit-remaining-*, x-ratelimit-reset-* (seconds) for the short, medium and long tiers.

For readers calling from the browser, each person has their own limit, so it is rarely reached. The real risk is your server: when you build a static site, render on the server or run a proxy, every request comes from one address.

  • When building a static site: call sequentially, about 1 request per second (under 120 requests/minute), use limit=100 to reduce the number of pages, and retry after a few seconds when you hit 429.
  • When rendering on the server per visit: put your own cache (for example 60 seconds) in front of the API. Do not turn every visit directly into an API request.
async function getWithRetry(url: string, tries = 4): Promise<Response> {
for (let i = 0; ; i++) {
const res = await fetch(url, { credentials: 'omit' })
if (res.status !== 429 || i === tries - 1) return res
await new Promise((r) => setTimeout(r, 2000 * 2 ** i)) // 2 s, 4 s, 8 s
}
}

Handling errors​

The error body shape and the code table: API reference, Error shape. Checklist:

  • 404 on an entry → your "Not found" page (with SSR, return a real 404 status). For a secondary language, consider retrying in the primary language (see).
  • 404 on /site → wrong site code, site disabled, or language not enabled. This is a configuration error; do not show it to readers as a blank page: use fallback content and log it.
  • info: null → staff have not entered the details yet; use the fallback name and address you prepared.
  • 400 → a bug in your code (wrong parameter, limit not in the list). Do not retry.
  • 429, 5xx, network errors → retry with backoff; while waiting, keep the current content on screen or show a "Could not load, try again" box.
  • Empty list (data: []) → show "No posts yet", especially for "Most read" on a new site.
  • Fields that may be missing → cover, excerpt, keys in meta, strings in info.
  • Validate the data you receive before using it (the type of each field), and filter bodyHtml again before inserting it into the page.
  • The view signal must never break the page: ignore every error.

Recommended architecture​

ApproachGood forNotes
Call from the browser (SPA)Small sites, small teamsSimplest; CORS is already open. Content appears after JavaScript runs, which is worse for SEO.
Static site (SSG) + browser calls for the dynamic partsMost parish websitesPre-build the page shell, menus, contact details and existing posts; load the latest list, search and "Most read" from the browser. Rebuild periodically (for example every hour) so new posts get static pages. Keep a browser-side fallback for slugs that did not exist at build time.
Server-side rendering (SSR) with a cacheLarge sites that need good SEO for every postPut your own 60-second cache in front, respect the rate limits, and return real 404/301 for missing/old slugs.

Whichever you choose:

  • Put the API base URL and the site code in configuration variables, not hard-coded in scattered places.
  • Route every fetch to the API through one function (correct credentials, no headers, correct parameter order).
  • Send the view signal only from the browser, never at build time.
Was this page helpful?