Re: Caching cgi hits

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 22 Feb 1997 13:41:04 +0100

Some additional notes on CGI caching:

If you have applications that are depending on user-agent and other
request headers, then there is currently only one way to make these work
together with caching, and that is to build a URL namespace that
contains all relevant information, and use temporary redirects (302) to
redirect the unencoded request to the encoded namespace (temporary
redirects are NOT cacheable, unless explicit permitted by Expires: or
Cache-Control: response headers).

Another good rule is to keep cacheable pages out of cgi-bin. Use another
prefix for cacheable CGI programs. This is since almost all caches don't
cache urls containing /cgi-bin/. (this cacheable cgi-bin prefix can in
fact be a virtual mapping to the same cgi-bin directory if you like...)

A third rule is that if your application is more of a translator/gateway
than a application, then build a virtual URL path to the information
instead of using a lot of query parameters (passed as PATH_INFO to
CGI-programs). This is to make the URL more intuitive, and to avoid the
query type URLs (which most caches don't cache). Most servers allow you
to map a "directory" to a CGI program, making the URL truly virtual.

And always: Remember to set Last-Modified or Expires: header in
generated reply (which one depends mainly on your information source).

---
Henrik Nordström
Received on Sat Feb 22 1997 - 06:05:40 MST

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