views:

298

answers:

1

Working on a project in AS3 I require to stream a few files for bandwidth testing purposes. The files needs to come from the CDN (the clients closest proxy) in order to make the bandwidth test reliable.

Of course if the remote files get cached in the clients browser the bandwidth test would not be reliable.

Usually I would add a time-stamp in the GET variables in order to trick the clients cache. But I can imagine this is a very bad practice working with a CDN.

So my question is :

how to force bypass the clients cache to retrieve a new version of a file without really changing the request ?

Thanks in advance,

T

EDIT :

The ideal would be to send a cache-control header in URLRequest (thanks Assaf!). Unfortunately I've been trying it out for a little while and it doesn't seem to work within FlashPlayer. Even on the web, people seems to be pessimistic about the subject.

Quick example :

var headers:Array = new Array(new URLRequestHeader("Cache-Control", "no-cache"));
urlRequest.requestHeaders = headers;
urlRequest.load(url);

Anybody ever managed to make something similar to work ?

+1  A: 

The proper way of doing it is specifying cache http control headers in your request, or configuring no-caching on the server.

If you have control over the server you can specify pragma no-cache, or something equivalent, so that certain files are never cached.

The timestamp is indeed not such a good idea, because it might screw with all kinds of caches along the way.

Assaf Lavie