5

I have a node / angular /nginx app and when I do a new deploy I need to force a cache expire on the browsers.

There are tools to do this for the js files (adding a ?version to the file) but they don't work for html templates and css.

Has anyone here had the same problem? How did you solve it?

Thanks

Ricardo Gomes
  • 1,268
  • 2
  • 15
  • 35
  • 2
    I have the same "bug" with a simple angular app (without nodejs): the html are cache by the browser and a ctrl+F5 is not enough to refresh the cache. http://stackoverflow.com/questions/29635443/how-to-force-firefox-to-bypass-bfcache-for-angular-js-partials – fluminis Feb 09 '16 at 14:44

1 Answers1

0

You need to change the nginx configuration in your server.

Here is an interesting article that you must read:

Your configuration should look like:

location ~* \.(?:css|js)$ {
  expires 1y; 
  add_header Cache-Control "public";
}

To make it expire in 1 year for example