Skip to content

fix: preserve graced pages on origin 5xx refreshes - #164

Merged
jonbaldie merged 1 commit into
masterfrom
fleet/worktree-varnish-161
Oct 24, 2026
Merged

jonbaldie merged 1 commit into
masterfrom
fleet/worktree-varnish-161

Conversation

@jonbaldie

Copy link
Copy Markdown
Owner

Summary

origin 5xx
  background refresh → abandon; preserve the good graced page
  foreground fetch   → deliver uncacheable error; no error grace

A delivered background 5xx replaced the graced 200. Handle errors before other storage-policy returns, remove ineffective 24h error grace, and document the behavior. Add a real HTTP regression with a scriptable origin fixture.

Fixes #161

Evidence

  • Before: IMAGE=varnish-161:run python3 test/e2e/assert-grace-5xx.py failed twice: first expired request 200 HIT Age: 2, next request 500 MISS Age: 0.
    After: make test-grace-5xx passes for 500/502/503, including error-only no-store/Set-Cookie, recovery, cold misses, and must-revalidate.
  • The original issue replay now returns five consecutive 200 HIT responses with the same origin ID and Age increasing from 3 to 7.
  • COMPOSE_PARALLEL_LIMIT=1 make -j1 test test-e2e-hard passed, serially.

Merge Danger

Door: two-way

Revert the cache policy change to roll back; no data migration.

Blast Radius: caching

All origin 5xx responses are uncacheable. Failed background refreshes preserve only the existing grace window, without extending it. Cold errors still reach clients; revalidation directives still prohibit stale serving.

Abandon failed background fetches instead of delivering a replacement object. Deliver cold origin errors as uncacheable responses and remove ineffective error grace. Cover 500/502/503, recovery, storage headers and mandatory revalidation with real HTTP traffic.
@jonbaldie
jonbaldie merged commit d120c9a into master Oct 24, 2026
2 checks passed
@jonbaldie
jonbaldie deleted the fleet/worktree-varnish-161 branch October 24, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: a 5xx from the origin replaces a graced cached page, so grace does not cover 500/502/503 outages

1 participant