0

guys, I have a problem with chrome caching in an angular/cli project.I'm using angular 4 and when I make some changes in HTML, CSS or JS files and deploy it on the server my chrome can not show the new changes and when I clear browser cache it shows them.

  • I had similar issues when I had a web-worker actived. You can unregister them in Chrome Dev Tools => Application => Service Workers while visiting the app. – mchl18 Jul 29 '18 at 05:26
  • 1
    I actually resolve the issue. In the Nginx config in web server, I just excluded the expiry for index.html – Mohammadreza Imani Jul 30 '18 at 06:08

3 Answers3

0

You can use Cache-Control headers. For e.g.

Cache-Control: no-cache, no-store, must-revalidate.

References :

WebPage caching across all browsers

Cache Control

HTTP Caching

Praveen Rai
  • 777
  • 1
  • 7
  • 28
0

The minimal configs needed to be set on the response header.

  • set "Cache-Control" with value "no-cache, no-store, must-revalidate"
  • set "Pragma" with "no-cache" // HTTP 1.0.
  • set "Expires" with "0"

With these values set, most of the browsers should not do caching.

Reference from How do we control web page caching, across all browsers?

-1

I had a similar issue too, my app was on NGINX, and I've added a header to NGINX config. file