• Coding
  • Bypassing ISP cache server

Hi,

Guys, here is my problem:

I have a little website for testing purpose, it contains images. on some ISPs you got the old copy of the page even if i updated the images.
is there any way to force the site (from server side) to load with a fresh copy and bypassing the cache server at ISP ?

thanks in advance.
Nuclear option is to just use the ISP as a tunnel. Connect to a VPN anywhere where the ISP is not the provider (don't VPN to a friend behind the same ISP). You can possibly lease a VPN for cheap these days.
thx arithma, but it's not a solution in my case. my goal is to let everyone visit my site get a fresh copy, regardless of his ISP options.
The css is usually that is cached and is the most annoying. Renaming the css file is the best way to ensure
that your viewers will get the newest up to date version.

You can add random number to a filename to ensure the newest version as well.
filename.js?34324324

Be careful, adding a random number will result in a new version everytime they call the file.

i think the php or asp.net files shouldnt be a problem.
Source: StackOverflow
StackOverFlow wrote You should use HTTP's Cache-Control header to achieve this.

In the response you should send:
Cache-Control: private, must-revalidate, max-age=0
private - Indicates that all or part of the response message is intended for a single user and MUST NOT be cached by a shared cache.
max-age=0 - Indicates that the client is willing to accept a response whose age is no greater than 0 seconds. I.e. responses are immediately stale.
must-revalidate - When present in a response received by a cache, that cache MUST NOT use the entry after it becomes stale to respond to a subsequent request without first revalidating it with the origin server.

You should also send a Pragma header for legacy HTTP/1.0 intermediary servers:
Pragma: no-cache
Related reading:

The caching chapter of the HTTP spec;
Mark Nottingham's HTTP caching tutorial.
If you're working with asp.net try adding something like the following to your code behind:
Response.CacheControl = "no-cache, no-store, must-revalidate";
If it is Php add the following code on the page you're making an http request against:
header('Cache-Control: no-store, no-cache, must-revalidate');
Hope that solves your problem.
You can add random number to a filename to ensure the newest version as well.
filename.js?34324324
Just to be accurate, you're not modifying the filename, you're adding a random field to the query string, which usually invalidates the cache. This is feasible when you're including assets (JS, CSS), less so when you are serving pages, because you wouldn't want to confuse Google into indexing multiple instances of the same page (sure, you can set a canonical meta tag, but I digress…). This trick is used in web frameworks like Ruby on Rails.
To add to what Samer said; depending on the framework used, it doesn't have to be a random number, but a number generated by your build process. That way the file is cached until you actually change it thus properly making use of the cache and avoiding this problem.

If it is a static website, you'd need to change the caching headers sent in .htaccess if you're using apache.