I am running httpd 2.2.3 with mod_cache in reverse proxy mode. The content being cached has a max-age of 0 so the cache is allowed to store it but must always validate it with the origin. If one does an unconditional HEAD on a piece of content that has been cached on the edge, you get a "HTTP 304 Not Modified" instead of a 200. Here is the headers from the origin in response to a first time request, HTTP/1.1 200 OK Date: Thu, 21 Dec 2006 21:05:11 GMT Server: Apache Last-Modified: Fri, 01 Dec 2006 22:35:51 GMT ETag: "4809a-4f-9f42dfc0" Accept-Ranges: bytes Content-Length: 79 Cache-Control: max-age=0, no-transform Expires: Thu, 21 Dec 2006 21:06:39 GMT svct: D=27819 usec Content-Type: text/html Connection: close Below is the HEAD request followed by the reply. HEAD /testing/basam/test.html HTTP/1.1 Host: edge.stream.aol.com HTTP/1.1 304 Not Modified Date: Thu, 21 Dec 2006 21:06:28 GMT Server: Apache Connection: close ETag: "4809a-4f-9f42dfc0" Expires: Thu, 21 Dec 2006 21:07:56 GMT Cache-Control: max-age=0 Below is the debug output from apache for the HEAD request. [Thu Dec 21 21:06:32 2006] [debug] mod_disk_cache.c(477): disk_cache: Recalled cached URL info header http://edge.stream.aol.com:80/testing/basam/test.html? [Thu Dec 21 21:06:32 2006] [debug] mod_disk_cache.c(750): disk_cache: Recalled headers for URL http://edge.stream.aol.com:80/testing/basam/test.html? [Thu Dec 21 21:06:32 2006] [debug] cache_storage.c(272): Cached response for /testing/basam/test.html isn't fresh. Adding/replacing conditional request headers. [Thu Dec 21 21:06:32 2006] [debug] mod_cache.c(129): Adding CACHE_SAVE filter for /testing/basam/test.html [Thu Dec 21 21:06:32 2006] [debug] mod_cache.c(136): Adding CACHE_REMOVE_URL filter for /testing/basam/test.html [Thu Dec 21 21:06:32 2006] [debug] mod_proxy_http.c(54): proxy: HTTP: canonicalising URL //origin.stream.aol.com/testing/basam/test.html [Thu Dec 21 21:06:32 2006] [debug] proxy_util.c(1378): [client 127.0.0.1] proxy: http: found worker http://origin.stream.aol.com/ for http://origin.stream.aol.com/testing/basam/test.html [Thu Dec 21 21:06:32 2006] [debug] mod_proxy.c(756): Running scheme http handler (attempt 0) [Thu Dec 21 21:06:32 2006] [debug] mod_proxy_http.c(1662): proxy: HTTP: serving URL http://origin.stream.aol.com/testing/basam/test.html [Thu Dec 21 21:06:32 2006] [debug] proxy_util.c(1798): proxy: HTTP: has acquired connection for (origin.stream.aol.com) [Thu Dec 21 21:06:32 2006] [debug] proxy_util.c(1858): proxy: connecting http://origin.stream.aol.com/testing/basam/test.html to origin.stream.aol.com:80 [Thu Dec 21 21:06:32 2006] [debug] proxy_util.c(1951): proxy: connected /testing/basam/test.html to origin.stream.aol.com:80 [Thu Dec 21 21:06:32 2006] [debug] proxy_util.c(2045): proxy: HTTP: fam 2 socket created to connect to origin.stream.aol.com [Thu Dec 21 21:06:32 2006] [debug] proxy_util.c(2141): proxy: HTTP: connection complete to 10.1.10.15:80 (origin.stream.aol.com) [Thu Dec 21 21:06:32 2006] [debug] mod_proxy_http.c(1541): proxy: header only [Thu Dec 21 21:06:32 2006] [debug] mod_cache.c(502): cache: /testing/basam/test.html not cached. Reason: HTTP HEAD request [Thu Dec 21 21:06:32 2006] [debug] proxy_util.c(1816): proxy: HTTP: has released connection for (origin.stream.aol.com)
Created attachment 20090 [details] Fix 304 on HEAD on expired object This patch fixes this for us (httpd-2.2.4 + patch for PR41475 + our mod_disk_cache patches). If running the standard mod_disk_cache then expired objects won't be deleted from the cache when they can't be revalidated, but it will at least return the correct status code to the client. For full discussion see the thread on dev@httpd: http://mail-archives.apache.org/mod_mbox/httpd-dev/200704.mbox/%3cPine.GSO.4.64.0704131659050.7482@kleopatra.acc.umu.se%3e
I have verified this patch works in our environment which is mod_cache for 2.2.4 + patch for PR41484. thanks, Sridhar
This bug is supposedly fixed in httpd 2.2.6, and should thus be closed.
Looks like it. You could even have marked it fixed yourself!