httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23130] New: - mod_cache does not cache content with valid Expires header
Date Fri, 12 Sep 2003 09:41:51 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23130>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23130

mod_cache does not cache content with valid Expires header

           Summary: mod_cache does not cache content with valid Expires
                    header
           Product: Apache httpd-2.0
           Version: 2.0.47
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: mod_cache
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: bjorn@exoweb.net


[ 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 */

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message