Skip to content

Signals

When someone publishes, Lightbolt posts to <frontend address>/_signal, right after the publish. When a signal fails, a task sends it again, within a minute.

POST /_signal
X-Lightbolt-Timestamp: 1793958347
X-Lightbolt-Signature: sha256=<HMAC-SHA256 of "<timestamp>.<body>" with the signing secret>

{"site": "ABC123", "environment": "production", "job": 157}

What it can carry

A signal carries each of these only when it changed:

  • data names services whose data changed. Fetch GET data/<service>/… again.
  • hosts means that a hostname was added, moved, removed, or switched off or on. Fetch GET hosts again.
  • engine and theme name a new engine or theme version to fetch.

Signing per purpose (v2)

From engine 1.121.0, each purpose has its own key. key(purpose) is the lowercase hex of HMAC-SHA256, with the signing secret as the key, over lightbolt-<purpose>-v2. The purposes are signal, check and preview.

The signal then carries X-Lightbolt-Signature: v2=<hex>. That is the HMAC of "<timestamp>.<body>" with key("signal"). Lightbolt sends v2 once every environment on that frontend runs 1.121.0 or newer. Until then, it sends sha256=, which is v1. v1 is still accepted.

How to handle it

  1. Check the signature, with a constant-time compare. Refuse a timestamp that is older than five minutes.
  2. Answer 2xx at once, and do the work afterwards.
  3. Read the manifest. A signal says that something changed, not what.
  4. Also poll the manifest every few minutes. Then a lost signal only delays a change.

Good to know

  • Signals follow no redirects.
  • Some changes come as a signal too:
    • publishing at a set time;
    • records that show from a date;
    • a day change, for sites with such content.

Also called: webhooks, publish webhook, cache invalidation, revalidation.

Last changed