CDN Still Returns 503 After the Origin Recovers? Check Error Caching and Retry-After
Create Time:2026-12-02 09:53:12
浏览量
1014

A recovered origin and a CDN edge cache still serving an older error to the browser

Your origin monitor is green, but users opening the same URL still get 503 Service Unavailable. Check whether the origin can serve the affected request and whether the CDN tried to fetch it again. If an edge location cached a 503 during the incident, it can keep serving that response until its error cache entry expires.

Compare the edge response with the origin logs

A 200 from /health confirms that the health check passed. Look up the affected hostname, path, query string, and method in the origin logs. If the CDN routes to several origins or a load-balanced pool, check which origin or instance received the failing request. One backend can still return 503 after the others have recovered.

From an affected region, send an occasional GET to the affected URL if GET was the failing method. Keep the query string and request headers that affect the cache key. Record the UTC time and save the response headers and body so you can match the request to CDN logs.

url='https://www.example.com/status-probe'
date -u '+%Y-%m-%dT%H:%M:%SZ'
curl -sS --max-time 15 -D edge.headers -o edge.body \
  -w 'status=%{http_code} total=%{time_total}s\n' "$url"

Check the request ID, edge location, cache result, and origin status. Repeated 503s from the same edge, cache hits, and an increasing Age with no corresponding origin fetches point to a cached error. Age estimates how long it has been since the origin generated or successfully validated the response. If the header is missing, use the CDN logs to check whether an origin fetch took place. RFC 9111, section 5.1

If a fresh fetch gets another 503 from the origin, investigate the route or backend still returning it. If the CDN reports a failure before contacting the origin, look up the provider's detailed error reason. CloudFront documents 503s from origin capacity limits and, in rare cases, from resource limits at an edge location. AWS CloudFront troubleshooting

Check the error cache lifetime for that URL

Find the CDN cache behavior that matched the request and check its error caching settings for 503. On CloudFront, when an applicable origin error response specifies max-age, s-maxage, or Expires, the error cache lifetime uses the greater of the header-derived duration and the Error Caching Minimum TTL. The cache behavior's Maximum TTL caps max-age and s-maxage. AWS CloudFront error caching documentation

Suppose an edge caches a 503 at 10:00:00 with an effective lifetime of 60 seconds. The origin recovers at 10:00:20, but that edge may keep serving the error until 10:01:00 unless the entry is invalidated sooner. An edge that never cached the 503 may already be returning 200.

Use the headers from the failing response to assess the error cache lifetime. Also check whether the CDN's custom error page changes the status or response body clients see. Record both the origin status and the viewer-facing status when comparing logs.

Read Retry-After as a client retry hint

Retry-After: 30 asks the client to wait 30 seconds after receiving the response. The field can also contain an HTTP date. The CDN's error cache lifetime comes from its cache rules, so record the two values separately. An edge can recover while a client is still waiting to retry. RFC 9110, section 10.2.3

For requests you can safely repeat, such as GETs, cap retry attempts and add a small random delay after the wait so clients avoid retrying all at once. For an order or payment request, the first attempt may have taken effect even if the client saw a timeout or 503. Check the operation status or use the API's idempotency mechanism before resending it.

Confirm recovery from the regions that saw 503s

Once the origin is stable and the logs show the edge serving a cached error, let the entry expire or invalidate the affected URL using your CDN's supported procedure. If you need to clear several URLs, start with a small batch and watch request volume at the origin.

From the regions that saw the failure, repeat the request to the same URL. Compare the edge response, origin status, and the client's observed retry time. To validate a TTL change, simulate a short 503 on a test path and log when the error starts, when the origin recovers, and when the edge first returns a successful response. The time between origin recovery and edge recovery shows how long users continued to see the cached error in that test.

References

References checked on December 2, 2026.