I have this script:
location ~* ^.+\.(css|js)$ {
expires -1;
access_log off;
add_header Pragma public;
add_header Cache-Control "public, max-age=0";
add_header X-Asset "yes";
}
But when I look at developer tools in Chrome I see this:
Cache-Control:max-age=2592000
Content-Encoding:gzip
Content-Type:application/javascript
Date:Mon, 12 Feb 2018 16:45:22 GMT
ETag:W/"5a81c436-e5d7f"
Expires:Wed, 14 Mar 2018 16:45:22 GMT
Last-Modified:Mon, 12 Feb 2018 16:43:34 GMT
Server:nginx
Vary:Accept-Encoding
How can I set that CSS and JS must be always realoading on page load. I have site from 3 years now, I really do not change nothing in it.
It's written in Ruby on Rails, and from about week, peoples start to write that they can't open some page because <% link_to "visits", visits_path %>
redirect them to root_path ...
I can't reproduce this error because on every my browser everything works ok, but once I have this situation and when I open developer tools and reload page to check for some errors, page just load properly. So I thought to always load JS on every page load.
EDIT:
Trying to change like one first answer I still see :
Cache-Control:max-age=31536000, public, max-age=0
Content-Encoding:gzip
Content-Type:application/javascript
Date:Thu, 15 Feb 2018 19:36:38 GMT
ETag:W/"5a85c673-8fb59"
Expires:Fri, 15 Feb 2019 19:36:38 GMT
Last-Modified:Thu, 15 Feb 2018 17:42:11 GMT
Pragma:public
Server:nginx
Vary:Accept-Encoding
X-Asset:yes
Only on Incognito Mode it works ok.