Deploying the Worker
Most deploys are automatic. Allegro uploads the current worker bundle to the organization's Cloudflare account, activates it, and syncs the property's routes. You can also deploy from the property's settings, or by hand with Wrangler when you need settings Allegro doesn't manage.
What a Deploy Does
For one property, a deploy:
- Uploads the bundle as a new version of the worker
allegro-edge-{organization}-{property}, creating the script on its first deploy. - Sets the worker's variables and the
EDGE_KEYsecret (see below). - Activates the new version for 100% of traffic.
- Creates or updates the route
{hostname}/*to the worker, creates the exclusion routes, and deletes any of this worker's routes that are no longer needed, such as those for an old hostname.
Deploys for the same property never run at the same time. A deploy is skipped when the live worker already runs the same release with the same configuration, unless someone clicks Deploy now.
Worker Variables and Secret
| Name | Type | Value |
|---|---|---|
ALLEGRO_ORIGIN | var | The property's Allegro base URL, used to call the evaluate endpoint. |
PROPERTY | var | The property slug. |
EDGE_HOSTNAME | var | The hostname the worker serves. Requests for any other host pass through. |
COOKIE_DOMAIN | var | The property's cookie domain, falling back to the organization's. |
EDGE_KEY | secret | A per-property key the worker sends to Allegro to prove its identity. |
EDGE_KEY is generated once per property and stored encrypted. Allegro uses it
to decide whether to trust the visitor IP and location the worker forwards.
Exclusion Routes
Static and admin paths never invoke the worker. Allegro creates a route with no worker for each of these patterns on the property's hostname:
/wp-content/*, /wp-includes/*, /wp-admin/*, /wp-json/*, /wp-login.php,
/xmlrpc.php, /feed*, /build/*, /favicon.ico, /robots.txt
The worker passes these paths and any non-HTML response through on its own, so a missing exclusion route costs a worker invocation but doesn't change the response.
Automatic Deploys
With EDGE_AUTO_DEPLOY on, deploys
start on their own when:
edge:releaserecords a new bundle during an Allegro deploy.- An organization connects Cloudflare, saves an API token, or picks an account.
- A property's Edge settings are saved. Turning Enabled off removes the worker's routes instead.
- The nightly retry at 04:00 runs, for properties whose last deploy failed.
Release rollouts and the nightly retry skip organizations that turned off Update automatically, have no Cloudflare connection, or don't have the Allegro Edge package enabled. A failed deploy is not retried until the nightly run.
Deploy and Roll Back from the Dashboard
The Deployment card on the property's Edge settings shows the live release, whether it is Up to date or some number of releases behind, and the last ten deployments with what triggered each one: New release, Settings change, Manual deploy, Rollback, or Automatic retry.
- Deploy now deploys the current release immediately, even when the
configuration hasn't changed and even with
EDGE_AUTO_DEPLOYoff. It's disabled until Cloudflare is connected and Edge is enabled. - Roll back on an earlier successful deployment re-activates that worker version in Cloudflare and records a rollback.
A rollback restores the worker code and variables of the earlier version only. If the hostname changed since then, routes stay on the current hostname.
Deploy, rollback, and the Edge settings are also available as MCP tools for AI clients.
Deploying by Hand
Use a manual deploy for local testing, or when you need worker variables Allegro doesn't set (see Tuning Variables). A hand-deployed worker is replaced the next time Allegro deploys the property, so turn off Update automatically for the organization first.
-
Print the property's worker configuration inside its tenant:
php artisan tenants:artisan "edge:worker-config my-site" --tenant=example-tenantThe command fails if the property doesn't exist, has Edge off, or has no hostname. It prints the worker
name,account_id,[vars], and[[routes]]blocks, the command to set the secret, and the exclusion patterns. -
Copy the printed
name,account_id,[vars], and[[routes]]over the placeholders inpackages/allegro-edge/worker/wrangler.toml. -
Log in and deploy from
packages/allegro-edge/worker:npx wrangler loginnpx wrangler deploy -
Set the edge key with the line the command printed:
echo "<edge key>" | npx wrangler secret put EDGE_KEY -
Create each exclusion route once with the Cloudflare API, since
wrangler.tomlcan't declare a route with no worker:curl -X POST https://api.cloudflare.com/client/v4/zones/<zone-id>/workers/routes \-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \-H "Content-Type: application/json" \-d '{"pattern":"www.acme.com/wp-admin/*"}'
Don't commit the filled-in wrangler.toml.