trafficserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Harrison <m...@omniti.com>
Subject Re: how to cache object with different urls (with question mark) just once?
Date Wed, 23 Mar 2011 16:23:32 GMT
> This meas that evey modified url you want to cached you have to write into
> this file?

> For example, i have a url like http://example.com/a.jpg?id=xxx, if i want
> cache this object, does mean i have to wirte  patterns/replacements
> in cacheurl.config?

Yes, the file specified a list of URLs and what you want the cache key
to be. In your case if you just wanted to strip off the query string
you could probably do something like:

http://example.com/([^?]*)\? http://example.com/$1

This would replace http://example.com/foo.jpg?some=1&query=2&string=3
with simply http://example.com/foo.jpg

(I've not tested this and it might need a little tweaking)

> it's possible use your plugin to catche some  unforeseeable modified url ?

I'm not sure what you mean by this. You need to specify (via patterns)
which URLs you wish to consider the same. You can however use regular
expressions to match a group of URLs as in the example above where
anything in example.com is matched, and it will ignore the query
string for the purposes of matching.

The other use case for this plugin is for when you have multiple
mirrors of the same content - e.g. http://server1.example.com/foo.jpg,
http://server2.example.com/foo.jpg. You can make a pattern such as:

http://server[12].example.com/(.*) http://server.example.com.ATSINTERNAL/$1

(The ATSINTERNAL here is simply something so that if
http://server.example.com/foo.jpg exists, but has different content
from http://server1.example.com/foo.jpg, then ATS doesn't consider
them to be the same. Any unique string could be used here).

Mark

Mime
View raw message