caching – React app served via Nginx/Docker shows stale JS & CSS in normal browser but fresh in incognito
My React app is served with Nginx inside Docker (with correct cache-control headers), but the outer server-level Nginx acting as a reverse proxy strips/overrides those headers, causing browsers to cache old files — which is why normal windows show stale content while private/incognito shows fresh content.
I tried:
Clearing browser cache (hard reload, emptied cache in dev tools).
Testing in incognito/private mode (which shows the correct fresh React build).
Clearing Nginx cache on the server, but caching is not enabled on the server’s Nginx config (only reverse proxy).
Updating cache-control headers in the React app’s Nginx config inside the Docker container.
What I see now:
Some updated JS files load correctly.
Some old JS files are still served.
Some CSS changes apply, but others still load the stale version.
I was expecting:
All JS and CSS files to update consistently in normal browser windows (like they do in private mode).
No stale content after deploying a new build.
Read more here: Source link
