Home » Php » php – Laravel elixer versioning (cache buster) multiple servers

php – Laravel elixer versioning (cache buster) multiple servers

Posted by: admin July 12, 2020 Leave a comment

Questions:

At the moment we have a new server environment with multiple servers, so the cache busting functionality of laravel elixer doesn’t work if we download the repository and run gulp, as each server has a different version of the .js and .css file.

The problem is load balancing can send the user to either server per request. Some browsers seem to be immune from the problem but for example I can’t load the css or js properly using JMeter for load testing.

Is there a way to syncronize the build without adding the compiled files to the repository or FTPing everything?

We are trying to automate the deployment by running a script that pulls down the latest repo every time productiosn branch is updated.

How to&Answers:

I think that the only solution for this problem is to commit compiled assets files.

I found this solution strange at first, because we don’t version vendor folder for example.

But at the end, I found that most of the front-end projects are always comitting a dist folder with compiled files.

So you would need to commit your build folder of your public path every time you make a modification to an asset file.

Of course, don’t forget to make a gulp --production before pushing to minimize your files.