How to handle web application static resources wich browser-cache in kubernetes?
We are trying to migrate or frontend apps to kubernetes. But when doing a rolling update there is a possibility that the users get 404 due to cacheing with unique sha1 hashes in the URI.
Simplified directory structure after build #1
/index.html /static/147964a6b54c/app.js /static/147964a6b54c/style.css
Simplified directory structure after build #2
/index.html /static/978b4ccd1dbb/app.js /static/978b4ccd1dbb/style.css
The app uses Cache-Control: public
We have 10 pods running in kubernetes.
We begin rolling update with default update interval of 60 sec.
The problem that can happend now is that the new index.html requests the new URI to app.js (with new hash) but it gets redirected to a container running the old app which does not have that path and therefore throws a 404.
One solution is to only rely on etag header but that makes the clients doing a roundtrip each time and that should not be needed. index.html should use this solution but not the other assets.
I wonder if any other people have run into this situation and found a good solution?