Skip to content

Edge proxy configuration

The proxy is configured by Worker environment variables, optionally overlaid by central config fetched from the CMP backend so you can change behaviour without redeploying.

Var Purpose
UPSTREAM Base URL of the central Lightning Worker the proxy forwards /v1/* to.
PREFIX First-party path prefix, e.g. /__consent.
COOKIE_GUARD on to strip non-consented Set-Cookie headers.
SCRIPT_GATE on to auto-gate tracker <script> tags in origin HTML.
COOKIE_MAP JSON mapping cookie names → category (exact match, or * suffix for prefix).
TRACKER_MAP JSON mapping tracker hosts → category.
UNKNOWN_COOKIE_POLICY keep (default, fail-open) or strip.
ESSENTIAL_COOKIES JSON array of cookie names always kept.
LICENSE_KEY Your license key.
EDGE_CONFIG_URL Central config endpoint; overlays local env, edge-cached ~300s.

Set LICENSE_KEY + EDGE_CONFIG_URL to manage the cookie/tracker maps centrally (no redeploy on change), or configure everything locally via the env vars above. A config-fetch failure falls back to local env — a bad fetch never takes the site down.

Two levers:

  • Behaviour/config — change central config; picked up within the cache TTL, no redeploy.
  • Code — a new @lightning-cmp/edge-proxy npm version is picked up on your next wrangler deploy.