Hallo Leute,
ich habe mal auf eine Seite gelesen, dass bei Wikipedia die Cache-Server mit Squid laufen und die nur für die Gäste cachen, da für alle Gäste der Inhalt gleich ist, für die Benutzer aber jede Seite anders ist (oben steht ja der Benutzername).
Wie ist das technisch gemacht? Ich stell mir das nicht so einfach vor, denn dazu muss der Squid doch für jede Anfrage feststellen ob der Cookie mit den Benutzerdaten gesetzt ist.
Weiß jemand wie das geht?
Ich dachte evtl über einen Header-Tag im HTML, aber das ist es nicht!
Danke
TO
Squid Cache nur für bestimmten Inhalt
Re: Squid Cache nur für bestimmten Inhalt
Sorry das ich gefragt habe, war zu schnell. Hier die Lösung:
http://www.aulinx.de/oss/code/wikipedia/The caching policy is controlled with HTTP Headers (sent from php). We're interested in these two headers:
'Vary: Accept-Encoding, Cookie'
This tells Squid to maintain separate cache items for compressed/not compressed pages (Accept-Encoding) and different Cookies [users], all for the same url. Currently we're sending Vary: User-Agent, i have no idea why. It defeats caching.
if anonymous:
'Cache-control: must-revalidate, max-age=0, s-maxage=600'
must-revalidate and max-age=0 force the browser to check back for updates and s-maxage tells squid to expire this page after 10 minutes
if logged in:
'Cache-control: must-revalidate, max-age=0, no-cache'
no caching when logged in, this is the same as sent now.
