[ Also reported for Apache 1.3.28 as BUG# 23129 ] This bug was first reported by James Cooper in 1999 (http://archive.apache.org/gnats/4089), but was somehow never included. Searching the web it is obvious that many people have found this bug through the years, but none (except James) have reported it. Instead, it's become "common knowledge" that for mod_proxy in Apache to cache content, it has to have a Last-Modified header. Just having an Expires header is not enough; it will always result in a X-Cache: MISS Last-Modified headers do not really make sense for dynamic content, so many HTTP Accelerator plugins for dynamic websites only generate Expires headers, assuming that it'll work fine, when it doesn't. This patch should fix this deficiency for 2.0.47 (not heavily tested): *** mod_cache.c-org Fri Sep 12 15:44:36 2003 --- mod_cache.c Fri Sep 12 15:44:41 2003 *************** *** 540,553 **** reason = "HTTP Status 304 Not Modified"; } else if (r->status == HTTP_OK && lastmods == NULL && etag == NULL && (conf->no_last_mod_ignore ==0)) { ! /* 200 OK response from HTTP/1.0 and up without a Last-Modified ! * header/Etag */ /* XXX mod-include clears last_modified/expires/etags - this * is why we have an optional function for a key-gen ;-) */ ! reason = "No Last-Modified or Etag header"; } else if (r->header_only) { /* HEAD requests */ --- 540,554 ---- reason = "HTTP Status 304 Not Modified"; } else if (r->status == HTTP_OK && lastmods == NULL && etag == NULL + && (exps == NULL || exp == APR_DATE_BAD) && (conf->no_last_mod_ignore ==0)) { ! /* 200 OK response from HTTP/1.0 and up without a Last-Modified, ! * Expires, or Etag header */ /* XXX mod-include clears last_modified/expires/etags - this * is why we have an optional function for a key-gen ;-) */ ! reason = "No Last-Modified, Expires, or Etag header"; } else if (r->header_only) { /* HEAD requests */
I just committed a fix based on your patch to the 2.1-dev branch. I have submitted it for backporting to the 2.0-stable tree. Thank you for your submission and for using Apache. One request, could you use unified diff format in the future for any patches (diff -u). It is the standard format that we all use. Thanks.