how to manually remove varnish caches or otherwise prevent caching

Status
Not open for further replies.

mercerb2

New Member
Messages
7
Reaction score
0
Points
1
I have been working on my site and it was was working wonderfully, but now it seems to have stopped updating when I change my files. After browsing the web for 5+ hours today, I have only found a few things and they are not very helpful. As far as I can tell, varnish is getting in the way when I try to load files (especially CSS files) because clearing browser cache and waiting for a while doesn't fix it. I have added the line:
Code:
Header set Cache-Control "max-age=0, private, no-cache, no-store, must-revalidate"
but to no avail. could varnish be caching my .htaccess file and not getting my new updates to the file? if so, how would I go about fixing this?
 

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
could varnish be caching my .htaccess file and not getting my new updates to the file?
short answer - no
only data being sent to the user's browser is cached by Varnish - if caching is not set off

You can also check at [ http://isvarnishworking.com ] to see if the modification to the [ .htaccess ] file is working. It should say "Yes! Sort of." and then you should see the Cache-Control header underneath

be sure that you added that line in the [ .htaccess ] file that is in folder [ public_html ]
 

mercerb2

New Member
Messages
7
Reaction score
0
Points
1
yes, yes, and yes. I see the "Yes! Sort of" text, I see the header, and I am absolutely positive that I put the line in the .htaccess in public_html
 

mercerb2

New Member
Messages
7
Reaction score
0
Points
1
I'm not sure why but it is no longer happening... I just hope it doesn't happen again!
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
Your stuff was already in cache and needed to age out before Varnish could see the "no-cache" header. Remember, the whole purpose of the cache is to prevent having to ask the server for a new copy until the one it has is "old", and files that should normally be static (CSS, images, JS) take a while to age out. Until the existing files age out, Varnish isn't even going to check with the web server, so it won't see the new headings. (In production, I'd typically set the cache parameter to something around a year and use filename versioning to force a change when I make changes since waiting for an age-out is impractical; no need for users to even request a file using a HEAD call for something they've already downloaded. And Varnish doesn't cache even static files for very long; it's only ever a problem if you're doing development on a production server.)
 
Status
Not open for further replies.
Top