The server seems to be lying about the age of .js files in the HTTP headers.

Status
Not open for further replies.

urcsx10m

New Member
Messages
2
Reaction score
0
Points
1
Maybe there's a trick here I don't know about, because I know almost nothing about cache control, but from where I'm standing it looks like the server is just straight-up lying, and it's stopping things from updating in a timely manner.

I noticed changes to .js files were taking quite a while to actually be reflected when I visit an associated page to see if they're working okay, and I started examining my headers with Fiddler.

So if I navigate directly to CommonFunctions.js in a web browser right now I have this in my request header:

If-Modified-Since: Mon, 09 Jan 2017 22:43:24 GMT

and I get this in the response header:
Last-Modified: Mon, 09 Jan 2017 22:43:24 GMT

...and in my browser I see an outdated version of the file.

Now I can check in file manager and see that actually the file was last updated Today at 3:27pm. (Today is Wednesday, Jan 11)

Setting aside for a moment and time zone issues, this is clearly not the same value. (If I open the file from the control panel and look inside it's the updated file).

I'm fairly certain this is not a matter of the browser caching the wrong file, because If I send a copy of the GET request through Postman it shows me the exact same thing Fiddler and a web browser did. (An outdated file with an incorrect last-modified time)

EVENTUALLY these things do update, but it seems to take half and hour to an hour from when I updated the file.

This only happens with certain file types. Changes to .php files are visible to a browser within a few seconds of my making them.
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
That's Varnish Cache doing what it's supposed to do. You'll need to modify the cache-control headers using .htaccess to turn off the cache. (Static files - HTML, JS, CSS, images - are by default assumed to be static and cacheable.)
 
Status
Not open for further replies.
Top