How to update WBS cache?

bosveld

Member
Joined
Apr 21, 2005
Messages
26
I have a webserver in the US and if I change web pages I see the cache server at WBS take many minutes (if not hours) to update the page. I have verified this many times.

Is there a way to get the cache to update.

WHAT DOES WORK

All my pages are PHP generated, so what I have been doing is to include a hidden tag in the text with the time (down to seconds) in it. This ensures that no two pages are the same.

The problem is the images, they are now cached.
What does work is if I don't call it using

http://myaddress.com/images/logo.gif BUT
http://myaddress.com/images/logo.gif?anything=1234

Isn't there a way to get the wbs cache server to refresh spesific pages.

Thanks
 

TheRoDent

Cool Ideas Rep
Joined
Aug 6, 2003
Messages
6,218
Putting a hidden timestamp in your HTML pages won't help to force the cache to reload your pages. The squid will still wait for it's object expiry, before even bothering to check if there's a new page.

The following code is recommended for your PHP pages.
Code:
<?php
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");
?>

If your pages are still cached after that, then WBS's proxy is violating the HTTP specification.

As for your images, typically the best way to handle that is to rename the image file on your server, and change the php/html to point to the new filename. That's the most bulletproof way, but also the most laborious way.

The other way, requires you to have administrative access to your webserver. In apache, the mod_expires and mod_headers will help you to produce headers for your static content that can force proxies NOT to cache them, or cache them only for a limited time (say 300 seconds).

Check http://www.websiteoptimization.com/speed/tweak/cache/ to see some examples of what can be done.

In IIS the "Content Expiration" tab of your virtual host will let you force expiry headers on static contents such as css, gif, or jpgs.
 
Top