Cloudflare
Connect Cloudflare so Ace tells edge errors from origin errors, records DNS, rule and Worker changes next to your deploys, opens incidents from Cloudflare notifications, and proposes edge fixes for approval.
Ace reads Cloudflare traffic and errors per hostname, security events, Workers and load balancers to investigate incidents at the edge. Cloudflare notifications open incidents, and DNS, rule, SSL and Worker changes join your workloads' change timeline so you see them next to your deploys.
| Category | Edge |
| Ace reads | HTTP analytics, firewall events, Workers analytics, audit logs, load balancer health, SSL status, Cloudflare's status page |
| Ace can change | Cache purge, Worker rollback, load balancer failover, security level, WAF rule toggle, each after approval |
| Opens incidents | Yes, from Cloudflare notifications, for workloads that route Cloudflare |
| Setup | Settings form |
What Ace reads
Ace reads every zone the token can see, or only the zones you list.
- HTTP analytics per hostname. Ace compares requests and the 5xx share with an equal window before the incident, and splits origin errors (your origin answered 5xx) from edge errors (Cloudflare couldn't reach or talk to the origin) so you know which side failed.
- Firewall events from WAF, managed and custom rules, rate limiting and bots. Ace groups them by action, rule, host and path, country, network and user agent, and compares them with the window before.
- Workers analytics per script: requests, errors, status codes and CPU time. Ace adds exception messages where it can read Workers Observability.
- Audit logs of account changes around the incident, with who made them. These cover DNS, zone and SSL settings, WAF and rate-limit rules, load balancers, pools, monitors, Tunnels, Workers and routes.
- Load balancer health: pool and origin health, which pools served traffic over the window, and failovers.
- SSL mode and edge certificates, for 525 and 526 errors.
- Platform incidents on Cloudflare's status page during the window.
Load balancer health and SSL status need the optional read permissions below. Ace checks them when you connect and uses only the reads your token allows.
To verify a fix, Ace reads the edge error rate for the affected host. For the System Map, it discovers zones, DNS records, Workers, Worker routes, Tunnels and load balancers.
What Ace can change
Ace proposes these actions once an admin turns on Allow Ace to run approved actions for the connection. Each one needs approval by default, and earned autonomy can let some of them run under an Automatic policy for a workload and environment you confirm. Others always need a person. See Actions and approvals.
| Action | What it does | Approval | Undo |
|---|---|---|---|
| Cloudflare cache purge | Purges cached copies of specific URLs, cache tags or URL prefixes in one zone. | Needs approval, can earn Automatic | No. Nothing restores a cache. |
| Cloudflare Worker rollback | Deploys an earlier version of a Worker at 100%. | Needs approval, can earn Automatic | Yes. Redeploys the split it replaced. |
| Cloudflare load balancer failover | Disables or enables a load balancer pool, or one origin in a pool, to fail traffic over. | Always a person | Yes |
| Cloudflare security level | Sets a zone's security level, for example I'm Under Attack. | Always a person | Yes |
| Cloudflare WAF rule toggle | Disables or enables one WAF custom rule or rate limiting rule in a zone. | Always a person | Yes |
Cloudflare can't report a token's edit permissions, so Settings lists each action as Shows when it runs: needs <permission>, and a missing permission shows up when Cloudflare refuses the change.
What opens an incident
Notifications reach Ace through a webhook destination as they fire, and one opens an incident only when a workload routes Cloudflare. To route it, open the workload's settings, turn on Integration alerts under Investigation triggers, and check Cloudflare under Alert sources.
These notification types open an incident, or join the one already open on the workload:
| Notification | Severity |
|---|---|
Origin error rate (http_alert_origin_error) | High |
Edge error rate (http_alert_edge_error) | High |
Advanced HTTP error alert (advanced_http_alert_error) | High |
Passive Origin Monitoring (real_origin_monitoring) | Critical |
Load balancing health (load_balancing_health_alert) | High |
Health check status (health_check_status_notification) | High |
Tunnel health (tunnel_health_event) | High |
The notification's end event, or a healthy status in it, resolves the incident. Load balancer pools and origins resolve separately.
These join an open incident as evidence and never open one:
- Cloudflare platform incidents (
incident_alert). - Custom certificate expiration for hostnames and zones.
- A load balancing pool being enabled or disabled.
- Maintenance notifications.
Universal, dedicated and custom SSL certificate events go to the change timeline. Ace drops every other notification type.
Ace also polls Cloudflare, so new failures still open incidents if a notification goes missing. Account changes from the audit log and Worker deployments go to the change timeline.
If you list zones by name, Ace drops notifications from other zones. A list of zone IDs can't filter them, because health check notifications name their zone, not its ID.
Before you start
- The admin role in Ace. See Roles and permissions.
- Permission to create API tokens for the Cloudflare account.
- The right Cloudflare plan and products for the notifications you want. Error-rate alerts need an Enterprise zone, and health check alerts need Pro or above. Others need Passive Origin Monitoring, Load Balancing, Advanced Certificate Manager or Cloudflare Tunnel. Ace subscribes only to notifications your account has.
Credentials and permissions
Ace uses one custom API token, limited to this account and its zones.
| Credential | Where to create it | Permissions | Why Ace needs it |
|---|---|---|---|
| API token (needed) | https://dash.cloudflare.com/profile/api-tokens | Zone: Zone Read, Zone: Analytics Read, Zone: DNS Read, Account: Account Analytics Read, Account: Account Settings Read, Account: Workers Scripts Read | Read zones, traffic, DNS, account analytics, audit logs and Workers. |
| Same token (optional reads) | Same | Zone: Load Balancers Read and Account: Load Balancing: Monitors and Pools Read | Load balancer health. |
| Zone: Workers Routes Read and Account: Cloudflare Tunnel Read | Worker routes and Tunnels on the System Map. | ||
| Zone: SSL and Certificates Read and Zone: Zone Settings Read | SSL status for 525 and 526 errors. | ||
| Zone: Health Checks Read and Account: Workers Observability Edit | Health checks, and Worker exception messages. Workers Observability has no read level. | ||
| Same token (only for alerts) | Same | Account: Notifications Edit | Add Ace's webhook destination and notifications. |
| Same token (only for actions) | Same | Zone: Cache Purge | Cache purge. |
| Account: Workers Scripts Edit | Worker rollback. | ||
| Account: Load Balancing: Monitors and Pools Edit | Load balancer failover. | ||
| Zone: Zone Settings Edit | Security level. | ||
| Zone: Zone WAF Edit | WAF rule toggle. |
Set up
1. Create the API token
- In Ace, open Settings > Data sources and choose Cloudflare. Enter your Account ID, then select Create key next to API token. Cloudflare's token page opens with a custom token named Ace and the six required read permissions added.
- Add the optional read rows you want. Add Account: Notifications Edit if Ace should wire alerts.
- Add edit rows only for the actions Ace may take after approval.
- Under Account Resources, include only this account. Under Zone Resources, include the zones you'll list in Ace, or all zones of the account.
- Optionally set a TTL. Select Continue to summary, then Create Token, and copy the token.
2. Connect Cloudflare in Ace
- Fill in the form:
- Account ID: the 32-character ID. On Account home, open Search (Cmd/Ctrl+K) and choose Copy account ID. You can also copy Account ID under Account Details on the Workers & Pages page.
- API token: the token you copied.
- Zones (optional): zone names or IDs, comma-separated. Use names if Ace wires alerts.
- Select Connect Cloudflare. Ace saves only if the token passes validation.
3. Wire alerts
If the token has Notifications Edit, Ace creates a webhook destination, attaches the health check, load balancing, Tunnel, SSL, error-rate and Cloudflare incident notifications your account has, and reports what it set up in the Alerts section. Ace never changes your own notifications, and it rechecks its setup hourly and removes it when you disconnect.
To wire alerts yourself, select Show manual setup in the Alerts section:
- Copy the webhook URL.
- Select Generate token and copy the token. Ace shows it once.
- In Cloudflare, open Notifications > Destinations, add a webhook with the URL, and paste the token as its Secret. Cloudflare sends it in the
cf-webhook-authheader of every notification. - Create the notifications that should open incidents, such as Health Checks, Load Balancing Health, Tunnel Health, SSL and Origin Error Rate, and send them to this webhook.
4. Optional: allow actions
- On the connected Cloudflare page, turn on Allow Ace to run approved actions.
- For automatic actions, select a workload, enter its environment (default
production), and select Confirm.
Confirm it's working
- The connection shows Connected once Ace verifies that the token can read your zones, analytics, DNS, audit logs and Workers.
- The Alerts section shows Waiting for first event until Ace accepts a notification, then Verified.
Disconnect
- In Ace, open Settings > Data sources > Cloudflare and select Disconnect. Ace removes its notifications and webhook destination, and if it can't, it tells you so you can remove
ace-<id>in Cloudflare yourself. - In Cloudflare, delete the API token.
Next steps
Vercel
Connect Vercel so your deploys join the change ledger next to incidents, and Ace can propose rollbacks, promotions, redeploys and firewall changes.
Trigger.dev
Connect Trigger.dev so failed production runs open incidents, deploys join the change ledger, and Ace can replay or cancel runs and pause queues after approval.