# Self-Healing CI: Recovering a CDN Cold Cache 504

> A 504 from a CDN on a cold cache is a transient origin-fetch blip, not a broken asset. See the manual fix and how self-healing CI retries the request.

Source: https://latchkey.dev/learn/self-healing-ci/self-healing-cdn-cold-cache-504  
Updated: 2026-06-26

A 504 from a CDN on the first request to an uncached path is a slow origin fetch, not a broken asset -- once the edge has warmed the object, the same request succeeds.

## What makes a failure safely retryable

Automatic retry is only correct for failures that are genuinely transient. Retrying a deterministic failure wastes minutes and hides a real defect, so the classification matters more than the retry mechanism.

- Safe to retry: network timeouts, registry 5xx, transient DNS failures, a service container that was not ready, a spot instance reclaimed mid-run.
- Not safe to retry: assertion failures, compile errors, lint violations, anything that fails identically on every attempt.
- Ambiguous, and worth investigating rather than retrying: out-of-memory kills, disk exhaustion, and flaky tests. These repeat under load and a retry only hides the trend.
- Always record that a retry happened. A pipeline that silently retries is a pipeline whose real failure rate you do not know.

## FAQ

### What causes Self-Healing CI: recovering a CDN cold cache 504?

A post-deploy check fails with a 504 Gateway Timeout from the CDN because the requested path was not cached and the edge’s origin fetch was slow on the first hit. The asset and origin are fine; the cold-cache fetch took too long once. A human re-runs and, with the object now warm at the edge, the request returns 200 unchanged.

### How do I fix Self-Healing CI: recovering a CDN cold cache 504 manually?

[object Object]

### Can Self-Healing CI: recovering a CDN cold cache 504 be fixed automatically?

A cold-cache 504 is distinguishable from a real origin outage by whether the request recovers once the edge warms the object. A self-healing CI pipeline detects the gateway-timeout-on-cold-cache condition, retries after the edge warms, and only escalates if the request keeps timing out, which is the real signal of a genuine origin

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
