My express application is running in an amazon ECS container behind an ALB load balancer.
For cachebusting webpack generates a new hash each time the app is built and released and appends it to the CSS file name (e.g. main.b938eb5b2934c85d13e0.css
).
During deployment of a new release, both containers (old version and new version) are running at the same time for about a minute and the LB routes requests to one of the containers randomly.
It then sometimes happens that users get the index.html
from the new container, but the following CSS request is routed to the old container, resulting in 404 because the hash part of the filename is different. Users then see a completely broken unstyled GUI.
How can this be avoided this without losing the cachebusting aspect?