Skip to content

Instantly share code, notes, and snippets.

@b3h3rkz
Last active June 3, 2018 17:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b3h3rkz/6113f01105bac92bad777a3e200b7945 to your computer and use it in GitHub Desktop.
Save b3h3rkz/6113f01105bac92bad777a3e200b7945 to your computer and use it in GitHub Desktop.
Prevent angular app from caching
Developing apps with angularjs comes with it's own headaches, one of which is the caching of files in the browser.
As a developer you can make use of plugins like Classic Cache Killer or disable caching in devtools. You can't go around asking all
your users to clear their cache after every new update
After going through several SO posts and blogs, only one solution worked for me(based on my setup).
Using Nginx, I added this directive
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
}
which was gotten from https://stackoverflow.com/questions/40243633/disable-nginx-cache-for-javascript-files.
After adding that, Dayum!!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment