Issue
I'm serving Angular 2 application with nginx using location section this way:
location / {
try_files $uri $uri/ /index.html =404;
}
try_files directive tries to find the requested uri in root directory and if it fails to find one it simply returns index.html
How to disable caching of index.html file?
Solution
Found a solution using nginx named locations:
location / {
gzip_static on;
try_files $uri @index;
}
location @index {
add_header Cache-Control no-cache;
expires 0;
try_files /index.html =404;
}
Answered By - Roman Kolesnikov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.