My current nginx configuration for HTTP content caching is something like this:
location ~* \.html$ {
expires -1;
}
location ~* \.(css|js|gif|jpe?g|png)$ {
expires 168h;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
As you see I've disabled caching on the HTML files since they get updated quite frequently. Now I want to update my configuration with HTML caching enabled by using a script to rename the parent directory of my html files. From:
view/*.htmls
To
view/randomString/*.htmls
So, basically what's happening is all my html files will be moved to a directory with random name, that will be generated during each deployment of the web-app. Is it the right approach? Or there is already a better way to achieve this?