Querystring vs. Squid Cacheserver

From: Andreas J. Koenig <andreas.koenig@dont-contact.us>
Date: 02 Mar 1999 10:04:37 +0100

(Cross-posted to mod_perl and squid mailing lists)

When I tried to evaluate the squid accellerator mode for my entirely
mod_perl driven server I made an interesting observation not about
accelerator mode but about normal cache mode.

The default config file of the Squid recommends to disable caching for
requests containing a questionmark. I quote a few lines:

  #There is no default. We recommend you uncomment the following
  #two lines.
  #
  #acl QUERY urlpath_regex cgi-bin \?
  #no_cache deny QUERY

If people installing squid really follow that recommendation, all my
careful considerations about Last-Modified and Expires headers are
worthless because *all* my URIs contain questionmarks.

From a mod_perl view I have an easy workaround with the following
PerlPostReadRequestHandler:

    sub handler {
      my($r) = @_;
      my $uri = $r->uri;
      if ( $uri !~ /\?/ && $uri =~ /(.+?);(.*)/ ) {
        my($u1,$u2) = ($1, $2);
        $u2 =~ s/\.htm//;
        $r->uri($u1);
        $r->args($u2);
      }
      DECLINED;
    }

With this handler I can pretend to be a static document to those
people who use bad heuristics. I can use the uri
    http://foo.com/query;A=b;C=d.htm
to access the equivalent query
    http://foo.com/query?A=b;C=d

But from the cache point of view, this results in a pretty broken
behaviour in so far now the document
    http://foo.com/query;C=d;A=b.htm
must not be regarded the same as the document
    http://foo.com/query;A=b;C=d.htm

Whereas the query
    http://foo.com/query?C=d;A=b
and the query
    http://foo.com/query?A=b;C=d
_are_ equivalent.

Opinions?

- Any good reasons why the recommendation in the squid.config file is
  there? Should it go?

- What seems more cache-friendly: my above handler or the correct
  query?

Thanks,

-- 
andreas
Received on Tue Mar 02 1999 - 02:02:32 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:45:06 MST