Squid change cache key
Lets say you want to s开发者_StackOverflow社区erve 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?
Use the vary header .
So you can have multiple version of a page depending of the vary header. But the browser must send the variant header so you don't have a lot of choice to do this. Cookie header can be use if your use case. Be careful PURGE method doesn't work with variant cache in squid !
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.
精彩评论