How to force cache expiration in node / angular / nginx application

I have a node / angular / nginx application, and when I do a new deployment, I need to make the cache expire in browsers.

There are tools for this for js files (adding? Versions to a file), but they do not work for html templates and css.

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

thanks

+5
source share
1 answer

You need to change the nginx configuration on your server.

Here is an interesting article in which you should read :

Your configuration should look like this:

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

To expire after 1 year, for example

0
source

Source: https://habr.com/ru/post/1242625/


All Articles