Versioning no longer Load Balancer friendly
See original GitHub issueHi
Upgraded from 0.10 today to 1.2.2 due to some issues I was having on our live servers, and have realised it has created another issue, now with the versioning.
Let’s say you have 2…n servers, that all individually update their code, and run npm run production
, they are all set up so they share a session state so, for the most part, it doesn’t matter which server they hit.
In the pre 1.0 versioning you might get a code update that for a short period of time creates an inconsistent state:
The browser gets told by server 1 /css/app.5ee7141a759a5fb7377a.css
is current, due to true Load Balancing it might try getting it from server 2 which hasn’t quite finished npm run production
yet. It gets a 404, no big deal, the browser requests that file next time and either manages to get it from a different server, or the other one had finished processing it.
Post 1.0, this creates a larger issue:
The browser gets told by server 1 /css/app..css?id=5ee7141a759a5fb7377a
is current, if server 2 hasn’t finished compiling yet, it might serve that client the old CSS code, the browser will cache this old code for days/weeks/months.
If we throw a CDN in the mix (something that I’m planning on doing), this creates an even larger issue, because it is possible in that small window, that it caches the old code (even though cachebusting on the new ID), and will serve that to many browsers. CDN even means that any Load Balancer stickiness (for browsers) is completely off the table as well.
It would be great to have the old versioning back (even as an option),
I realise the query string keeps things a bit tidier, but it does mean in multi-server setups there’s no guarantee that the file version being served is actually the right version - having the file existing/not existing is really the only guarantee here.
Thanks
Ben
Issue Analytics
- State:
- Created 6 years ago
- Reactions:21
- Comments:54 (13 by maintainers)
Top GitHub Comments
I am doing it like this:
It reads the mix-mainfest.json file and copies e.g. app.css to app.hash.css and then writes a new manifest. Also deletes old versioned files. Onyl works if every entry in manifest is versioned.
He may be working on something as a convenience, however there nothing broke here.