How Nginx Cache-Control Headers Can Delay Critical React Hotfixes Reaching Users
When developers deploy a React hotfix, some users may continue seeing the old version due to browser-side caching behavior that silently works against urgent updates. Browsers apply heuristic caching — defined in RFC 7234 — when no explicit Cache-Control headers are set, calculating a time-to-live based on a file's Last-Modified timestamp provided automatically by Nginx. Immediately after a fresh deploy, this TTL is near zero, so everything appears fine, but as days pass the TTL grows, meaning browsers serve stale files without ever contacting the server. The root cause is that browsers only send a conditional revalidation request to Nginx after the TTL expires, so ETags and updated files are never checked while the cache is still considered valid. The fix involves explicitly setting Cache-Control response headers in Nginx configuration, giving developers direct control over how long browsers store static assets.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in