Configuring Nginx proxy_cache_use_stale with retry directives to avoid duplicate writes
0 reputation · 10 Jun 2022, 17:18 UTC
The goal is to prevent duplicate writes when Nginx retries an upstream request while a stale response is being served via proxy_cache_use_stale.
Nginx documentation does not define how proxy_next_upstream retry settings interact with proxy_cache_use_stale, leaving uncertainty about whether retries will bypass the cache or trigger new upstream calls for unsafe HTTP methods.
How can proxy_next_upstream retry configurations be combined with proxy_cache_use_stale to guarantee exactly‑once semantics for POST, PUT, or DELETE operations? Is there a documented method to ensure that a retry does not cause a duplicate write when a stale response is cached?