2004-12-01

Here's something interesting I picked out of a cacheability test of CW's RSS [1]

  • This object will be fresh for 10 sec.
  • It can be validated with Last-Modified.
  • Because it contains a query ('?') in the URL, many caches will not keep this object.
  • Because it has 'cgi-bin' in the URL, many caches will not keep this object.
  • It doesn't have a Content-Length header present, so it can't be used in a HTTP/1.0 persistent connection.

The effort involved in getting "last-modified" working looks to be wasted. I suggest the following:

  • While 10 seconds might be reasonable for C2's RC, it's crazy for CommunityWiki. Cache-control can be dropped.
  • All CW's pages come out of cgi-bin, and are thus limited in cacheability. Why not use http://www.emacswiki.org/community/PageName instead?
  • The same hack can get rid of the query ('?') in general

Alex?

I'm not sure what the result of our IRC chat was. I think my log analysis showed that it works for at least some users, therefore I was correct in assuming broken caches on your side. Do you agree with that conclusion?

What do you mean by "broken caches on [my] side"? What I've written above is simply the analysis of a "cacheability tester", presumably written by people with experience. It says "many caches will not", not "none will"; the question is, are broken caches a significant factor that are worth exploiting? I've no idea.

I'd still prefer new URIs from a stylistic viewpoint - as would Tim Berners-Lee [2], incidentally :)

I just wasted another hour trying to find some Apache URL rewriting rules that didn't add slashes at the end my URL and gave up.

What are you specifically tring to rewrite? I.e., what are the "before" and "after"? I or someone else may be able to pitch in some suggestions. – ScottMoonen

Currently, this page is ("before"):

http://www.emacswiki.org/cgi-bin/community/2004-12-01

If we take the advice of "Cool URIs don't change", we want something like

After:

I find the last one very pretty. Alex already has made it work. Unfortunately, it's a redirect, not a Apache rewrite – and so cannot be cached.

 RewriteRule http://www.emacswiki.org/community/(.*) http://www.emacswiki.org/cgi-bin/community?$1

Did this not work at all, Alex?

Even better, to get old links redirected (helping out Google), rename the CW script "community.cgi" and use:

 RewriteRule http://www.emacswiki.org/cgi-bin/community http://www.emacswiki.org/community/%{QUERY_STRING} [R=301]
 RewriteRule http://www.emacswiki.org/cgi-bin/community/(.*) http://www.emacswiki.org/community/$1 [R=301]
 RewriteRule http://www.emacswiki.org/community/(.*) http://www.emacswiki.org/cgi-bin/community.cgi?$1

You'll need to put them in the right .htaccess files, of course.

Since I'm using the community subdirectory for images and CSS file, I used "cw".

    RewriteRule ^cw(.*) /cgi-bin/community$1
    Redirect permanent ^/community/index.html http://www.emacswiki.org/cw

In cgi-bin, I renamed all the community scripts to cw, and used the following rule (for /cgi-bin/community-de.pl → /cw-de):

    RedirectMatch permanent ^/cgi-bin/community([^.]*).* http://www.emacswiki.org/cw$1

I can't believe this is so important for some of you. :) I think the only think that is really required is setting up communitywiki.org.

Wooot! Thanks, Alex!

The only thing missing is a query-less URL for the default RSS feed (for those remaining broken caches)… ;)

Yay! Alex has now fixed this. Applause!! (Note to self: stop abusing exclamation-marks.)

EditNearLinks: ScottMoonen

Languages: