Quickstart

Quickstart: Serve the catalogue behind your CDN

Put your CDN in front of the catalogue with a stale-while-revalidate policy and readers get edge-speed data while the API sees almost no traffic. This recipe gives you the exact code, uses only the unauthenticated public ring, and links to the endpoints and the application flow so the reader always has a next step.

2 min read

edge cacheNear-zero latency
SWRServe stale, refresh
shieldedOrigin barely hit

Cache at the edge

Have a small origin route fetch and normalise the catalogue, then set caching headers your CDN honours:

Cache-Control: public, max-age=3600, stale-while-revalidate=86400

The CDN serves the cached copy for an hour, then serves slightly stale data while it refreshes in the background — the reader never waits and the API is shielded.

Purge on change

If you need instant updates, purge the CDN key when you detect a catalogue change (via ETag polling). Otherwise the max-age handles freshness.

Frequently asked questions

Which caching header matters?

Cache-Control with max-age and stale-while-revalidate. The CDN serves fast and refreshes behind the scenes, so the origin is rarely hit.

How do I force a refresh?

Purge the cache key when you detect a change. For most integrations the max-age is enough and no manual purge is needed.

Funding for UK limited companies

Credicorp lends to your company, not to you personally — short-term working capital with no personal guarantee. See what your business could access.