Hi there,
I am trying to set up a mediawiki with squid as http accellerator, but I'm only partially succesful. As far as I can judge, the setup appears to be responding just fine; pages get cached by squid and when they are edited they are PURGEd from the cache. So far, so good.
However, when I log in, the logged in version of the page gets cached by my browser, leading to strange effects when logging out. Returning to the page will display the logged in version even though I'm not logged in. Refreshing the page in the browser fixes the problem. I have checked with a second browser; squid is not caching the logged in version of pages.
The documentation is kind of flimsy (;-)) when it comes to configuring mediawiki + squid. Most info I found came from:
http://www.aulinx.de/oss/code/wikipedia/ http://wiki.aulinx.de/Cache-Control
Any ideas what I am doing wrong in my squid config? Relevant lines are pasted below:
------------------------------------------------------------- #We recommend you to use the following two lines. acl QUERY urlpath_regex cgi-bin ? no_cache deny QUERY
# Allow access to the web ports acl web_ports port 80 http_access allow web_ports
# Allow purge acl purge method PURGE http_access allow purge localhost http_access deny purge
# Default match refresh_pattern . 0 20% 4320 -------------------------------------------------------------
All advice is appreciated.
Greetings,
Patrick
On Nov 13, 2004, at 3:21 AM, Patrick Atoon wrote:
However, when I log in, the logged in version of the page gets cached by my browser, leading to strange effects when logging out. Returning to the page will display the logged in version even though I'm not logged in. Refreshing the page in the browser fixes the problem. I have checked with a second browser; squid is not caching the logged in version of pages.
This sounds normal; in fact you should see the same behavior without using Squid.
When you log in, you get a login session cookie, so Squid doesn't give you the public no-cookie pages. Also all pages you visit are now marked by the wiki as for private caching only, so squid won't mess with them. Your per-user cache-invalidation timestamp is also updated at login, to ensure that any pages you had visited prior to logging in get rerendered for you in the logged-in state.
(When fetching a previously cached page, the browser sends an If-Modified-Since header with the timestamp of when it last loaded the page. The wiki checks this given timestamp against a wiki-wide cache epoch, the current user's user_touched timestamp [updated on login and preference change], and the page's cur_touched timestamp [updated on edit, change of existence state of linked pages, and edit of used/linked templates]. If any of those are more recent than the time given, the page is re-rendered. If they're all older, a 304 Not Modified response is sent and the browser shows its cached copy.)
When you log out, the wiki just changes your session data to remove the login info. You still have a session cookie, but since you're no longer attached to a user account you don't have a per-user cache invalidation timestamp. Thus the wiki doesn't know that the pages you visited before logging out perhaps should be re-rendered in the logged-out state; it tells your browser that the page hasn't changed (since it hasn't been edited) and the locally cached copy is shown.
It might be possible to stick a cache invalidation timestamp into the session on logout, but I'm not sure how consistently this would work.
-- brion vibber (brion @ pobox.com)
mediawiki-l@lists.wikimedia.org