Reputation: 3301
I have set up a single page app for my app using AngularJS and gulp. Each time I run gulp build
it will compile my assets in minified JavaScript and CSS such as app98D9898.css
. For each build the number will change randomly.
I have an HTML page called index.html
which will try to load the CSS and JavaScript files.
Until now everything is working as expected.
I use NGINX as a proxy to serve my static files. The big issue I have: it seems Chrome and Firefox are caching the index.html
file. Thus, If I build new version of my app, the browsers will continue to load the old version.
I'm looking for a solution to rpevent this behavior using NGINX to specify to not cache the index.html
file. Do you have an idea how I could proceed?
Upvotes: 1
Views: 1549
Reputation: 6841
You can setup a location in the server block to give html files a short expires time and disable the proxy cache.
location ~* \.(html)$ {
expires 1h;
proxy_cache off;
...
}
Upvotes: 3