I have a file called loader.js
that I don’t want to cache. So, below is the block of code I have implemented. This is on Django-One-Click app.
# to prevent the caching of loader.js
location ~* loader\.js$ {
add_header Cache-Control "no-store";
}
I ran sudo nginx -t
, it came out successful and restarted nginx. But, once I add the block, loader.js becomes 404. What am I doing wrong?
Thanks.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Location still need to return the file itself.
This will serve /loader.js, /whatever/loader.js so be careful. If you call loader always from root, you can use location = /loader.js