Prerequisites
- A Cloudflare account with Workers enabled.
- Node 25.8 or newer.
- The mantis CLI, linked or runnable from the source repository.
1. Generate and store the edge key
Generate one 32-byte base64url key:mantis edge set-key <url> <key>.)
The key is the minting authority. Anyone with it can create valid edge URLs, so keep it in the OS keychain via the CLI and avoid putting it in shell history or CI logs.
2. Restrict webhook destinations
For defense-in-depth, set an optional comma-separated allowlist. Wrangler prompts for the value:hooks.slack.commatches exactlyhooks.slack.com.*.example.commatches subdomains likealerts.example.com, but notexample.com.- Full URLs are accepted in the setting, but only their hostname is used.
404 as invalid URLs. The Worker logs a sanitized host-only message for the operator.
3. Deploy
mantis edge deploy runs the
worker’s own wrangler deploy via npx, captures the deployed URL, and with
--set-key stores the AES key for it in one step.
Wrangler prints the deployed Worker URL, usually:
wrangler.toml:
4. Verify
Mint a URL that posts to a test webhook. Use--channel to pick a payload format the receiver understands (webhook, slack, discord, teams); omit it for raw mantis.hit JSON. Add --test to fire a synthetic hit right after mint so you find out about config drift (allowlist, key mismatch) before handing the URL off:
- The HTTP response matches the minted response kind, usually
200 image/gif. - The webhook receives a
mantis.hitpayload. - Cloudflare Worker logs stay quiet on success.
cache-control: no-store, HTML responses
also include a restrictive CSP sandbox, and forwarded webhook payloads include
only an allowlisted/capped header snapshot. Credential-shaped request headers
such as cookies, authorization, Cloudflare Access JWTs, session tokens, CSRF
tokens, and API-key-looking names are dropped before forwarding; x-mantis-*
installer headers are preserved.
For failure debugging:
5. Local development
6. CI deploys
Use Cloudflare’s API token support for CI:7. Rotation
RotatingMANTIS_EDGE_KEY immediately invalidates all existing edge URLs. A practical rotation:
- Generate a new key with
mantis edge keygen. - Update the Worker secret with
pnpm exec wrangler secret put MANTIS_EDGE_KEY(paste the new key when prompted). - Update the local CLI key with
mantis edge set-key <url>(paste the new key when prompted). - Re-mint any URLs that should keep working.
--expires-at when minting short-lived URLs so old URLs naturally age out.