vendredi 8 mars 2019

Cache busting is not working in Production

I am trying to solve a caching issue that really has me scratching my head.

We have a Laravel app built in Docker that is deployed to Staging and Production.

  • Assets are built with Laravel Mix which is using Webpack. All of our files are versioned.

  • Staging is in debug mode while Production is not.

  • Staging is a single instance behind a load balancer, Production is two instances behind a load balancer.

  • Both are using the same Nginx Configs

  • Both sites are using Cloud Front, with the same caching behaviors. Origin Cache headers do not forward cookies, white lists query string using ID

When we deploy to Staging Everything works as expected.

When we deploy to Production, the CSS and Javascript are cached with the previous version.

I checked the asset hashes and they are the same, they both have hits from cloud front.

When I download the CSS files and diff production to stating they are not the same.

What really boggles my mind, is when I change the cache key on production I can see a miss from cloud front, reload hit from cloud front. Download and diff staging and production, they are now the same.

I have NO idea what is going on or where to look, Any ideas would be much appreciated!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire