tags:

views:

36

answers:

1

Lets say you want to serve different content from the same url but still want to be able to use squid caching.

For example caching a logged in users homepage vs another user. Is there anyway to append a cookie to the request url before throwing it into the squid's cache?

A: 

Try playing with storeurl_rewrite_program:

http://www.squid-cache.org/Versions/v2/2.7/cfgman/storeurl_rewrite_program.html

Basically, it acts like a normal Squid rewrite / redirector program, but it ONLY affects the URL used to look up / store in the cache.

Mark Nottingham
Yeah I looked into using a rewrite program but the program isn't given enough information about the request (ie cookie key/values) to do what I want.For each requested URL rewriter will receive on line with the formatURL <SP> client_ip "/" fqdn <SP> user <SP> method <SP> urlgroup [<SP> kvpairs] <NL>currently kvpairs are not supported, I assume they would solve this problem.
Ken Struys
Yes. I've had the same use case, and had to hack Squid to pass a configured request header to the rewriter to help make the decision.It's not a huge change to hack it for a once-off (see store_rewrite.c:storeurlStart), but it's a bit more involved to do it right so it can be folded back into the Squid (which I'd like to do at some point).
Mark Nottingham