Velora CMS Developers

Caching and the revalidate webhook#

Cache every read your front end makes, and keep it until Velora says its answer changed. When published content changes, Velora sends your front end a signed webhook that names exactly the requests whose answers changed. Drop those and keep the rest. A front end built this way serves every page from its own cache, and an edit or a takedown is live within seconds.

Name each read#

Velora names a request the way your front end makes it, after the Site id:

You call Velora names it
/site?key=... /site
/articles?limit=3&category=news /articles?category=news&limit=3
/resolve?path=/racing/tour-stage-one /resolve?path=%2Fracing%2Ftour-stage-one
/many?r=/site&r=/home /many?r=%2Fsite&r=%2Fhome

URLSearchParams in JavaScript and urlencode in Python encode this way. The simplest way to get it right is to build every request from the sorted query yourself and use that same string as the cache key. Send the read key in the Authorization header so it never appears in the name.

Tag each cached read with its name. In Next.js, for example, that is a cache tag on the fetch, such as velora:/articles?category=news&limit=3.

Keep each answer an hour at most#

Some answers change without a webhook naming them: an article's related list, for one, picks up newer articles over time. Keep each answer until the webhook names it, or for an hour, whichever comes first. Velora's edge does the same: no copy anywhere outlives the hour after its answer was built (X-Velora-Built, in Unix seconds).

Reads not to cache#

These are never named by the webhook. Do not keep them, or keep them briefly:

The revalidate webhook#

When content changes, Velora sends a POST to your Revalidate URL (Connect):

POST /api/revalidate HTTP/1.1
Content-Type: application/json
X-Velora-Signature: sha256=5d1c0e...

{
  "site_id": "6c0f...",
  "reason": "article_updated",
  "requests": ["/articles/tour-stage-one", "/home", "/resolve?path=%2Fracing%2Ftour-stage-one"],
  "everything": false,
  "sent_at": "2026-11-23T10:15:02.114Z"
}
Field Meaning
requests Every request whose answer changed, named as above. Drop each from your cache.
everything true when the Site's settings, navigation, sections, pages or redirects changed. Any answer may have changed: drop every cached read.
reason Why, for your logs: article_updated, article_removed and others. Do not branch on it.
site_id, sent_at Which Site, and when.

Your handler:

  1. Reads the raw body, as bytes, before parsing it.
  2. Checks the signature (below). Answers 401 if it is wrong.
  3. Drops every named request from its cache, or everything when everything is true. Drop the cached answers outright: a taken-down article must not be shown again, even once while a fresh copy loads.
  4. Drops the pages built from those reads. Frameworks that tag reads do this for you.
  5. Answers 200 within 5 seconds.

By the time the webhook arrives, Velora has already cleared its edge's copies, so your next read of a named request gets the new answer.

Check the signature#

X-Velora-Signature is sha256= followed by the hex HMAC-SHA256 of the raw request body, keyed with the webhook secret. Compute it over the exact bytes you received, not over JSON you parsed and serialised again, and compare in constant time.

import { createHmac, timingSafeEqual } from "node:crypto";

export function validSignature(rawBody: string, header: string | null, secret: string): boolean {
  if (!header?.startsWith("sha256=")) return false;
  const expected = Buffer.from(createHmac("sha256", secret).update(rawBody).digest("hex"));
  const given = Buffer.from(header.slice("sha256=".length).toLowerCase());
  return expected.length === given.length && timingSafeEqual(expected, given);
}
import hashlib, hmac

def valid_signature(raw_body: bytes, header: str | None, secret: str) -> bool:
    if not header or not header.startswith("sha256="):
        return False
    expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, header.removeprefix("sha256=").lower())

Repeats, batching and failures#

Several reads in one call#

/many takes up to ten reads as repeated r parameters, each a request as its own route takes it, and answers each in order with its status and body:

curl -H "Authorization: Bearer $VELORA_READ_KEY" \
  "https://delivery.velora.build/$SITE_ID/many?r=/site&r=/articles?category=news%26limit=3"
{"results": [
  {"request": "/site", "status": 200, "body": {"name": "..."}},
  {"request": "/articles?category=news&limit=3", "status": 200, "body": {"items": []}}
]}

A batch is cached and named like any read: the webhook names the /many request when any read in it changes. One read answering 404 does not fail the batch; one failing with 500 or more fails all of it. A batch cannot hold /many, /preview/..., /changes, /search, /llms.txt or a read with a cursor.

Keeping a copy in step#

For a search index, a mirror or an agent that keeps its own copy, poll /changes instead of handling the webhook. It lists every article whose state changed for readers, oldest first: live (published or updated) or removed (taken down). Start without a cursor (or with an ISO time), then pass back next_cursor each time. It is never cached.

This page as markdown: https://developers.velora.build/caching.md