https://issues.apache.org/bugzilla/show_bug.cgi?id=45341


Mike Venzke <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW




--- Comment #11 from Mike Venzke <[email protected]>  2009-04-28 05:22:09 PST 
---
This has nothing to do with query strings.

It is as stated already:

1) the user submits a normal request but the item in ache is expired
2) mod_cache submits a conditional request to the upstream server looking for a
new version
3) the upstream server responds with a 304 Not Modified, but then also includes
headers that indicate this previously cached item is no longer cacheable.
Either
because the expires haven't been updated, the cache rules have changed, etc.
4) mod_cache checks for cacheability of the response, and if it cannot be
cached (i.e., if 'reason' is set in the cache save filter), then it serves the
upstream response directly, with no regard for whether the original request was
conditional or not.

As stated, the best options are to either a) serve the content as-is from
cache, then purge it so subsequent requests come from the origin, or b)
re-request from the upstream server without the conditional headers, and pass
on
the full result to the user.

b) is probably the most standards-compliant. I have chosen to do a) for now. By
not removing the cache_remove filter, the item is removed from cache after
being served for this request.

I can say that not fixing this makes mod_cache unusable in production, as it is
never ok to return a 304 Not Modified / blank body to a non-conditional
request, under any standard. This is a bad bug, unconfined to query strings not
returning expires, or any other scenario thus far presented. It is perfectly
reasonable to expect that an upstream server may change the cache rules for a
piece of content, and it needs to be able to handle that on revalidation
without creating an error for the user.

Here is debug output. The scenario is that the cached item is cached, but
expired, and the upstream server is responding with an Expires header in the
past. The dates of the cached item were specifically altered for this test to
be in the past, as well as the response from the upstream, but this spawned
from real-world scenarios.

* Please note, the line numbers will not directly correspond to line numbers in
httpd repository. This server is running a modified 2.2.11.


[Tue Apr 28 04:39:30 2009] [debug] mod_disk_cache.c(1217): disk_cache: Recalled
status for cached URL http://host.com:80/content.file? from file
/path/cache/path.header
[Tue Apr 28 04:39:30 2009] [debug] mod_disk_cache.c(1758): disk_cache: Recalled
headers for URL http://host.com:80/content.file?
[Tue Apr 28 04:39:30 2009] [debug] cache_storage.c(361): Cached response for
/content.file isn't fresh.  Adding/replacing conditional request headers.
[Tue Apr 28 04:39:30 2009] [debug] mod_cache.c(690): Adding CACHE_SAVE filter
for /content.file
[Tue Apr 28 04:39:30 2009] [debug] mod_cache.c(703): Adding CACHE_REMOVE_URL
filter for /content.file
[Tue Apr 28 04:39:30 2009] [debug] mod_proxy_balancer.c(46): proxy: BALANCER:
***
[Tue Apr 28 04:39:30 2009] [debug] mod_proxy_balancer.c(1301): proxy: ***
[Tue Apr 28 04:39:30 2009] [debug] mod_proxy_balancer.c(1369): proxy ***
[Tue Apr 28 04:39:30 2009] [debug] mod_proxy.c(1006): Running scheme balancer
handler (attempt 0)
[Tue Apr 28 04:39:30 2009] [debug] mod_proxy_http.c(2135): proxy: HTTP: serving
URL http://upstream/content.file
[Tue Apr 28 04:39:30 2009] [debug] proxy_util.c(1999): proxy: HTTP: has
acquired connection for (upstream)
[Tue Apr 28 04:39:30 2009] [debug] proxy_util.c(2055): proxy: connecting
http://upstream/content.file to upstream:80
[Tue Apr 28 04:39:30 2009] [debug] proxy_util.c(2153): proxy: connected
/contet.file to upstream:80
[Tue Apr 28 04:39:30 2009] [debug] proxy_util.c(2308): proxy: HTTP: fam 2
socket created to connect to upstream
[Tue Apr 28 04:39:30 2009] [debug] proxy_util.c(2414): proxy: HTTP: connection
complete to upsteam:80 (upstream)
[Tue Apr 28 04:39:30 2009] [debug] mod_proxy_http.c(2005): proxy: header only
[Tue Apr 28 04:39:30 2009] [debug] mod_cache.c(1214): cache: /contet.file not
cached. Reason: Expires header already expired, not cacheable
[Tue Apr 28 04:39:30 2009] [debug] mod_cache.c(1687): in CACHE_REMOVE_URL
filter, and there is a cache
[Tue Apr 28 04:39:30 2009] [debug] mod_disk_cache.c(88): ** removed item **
[Tue Apr 28 04:39:30 2009] [debug] proxy_util.c(2017): proxy: HTTP: has
released connection for (upstream)
[Tue Apr 28 04:39:30 2009] [debug] mod_proxy.c(1053): proxy_handler(cleanup):
access_status: 0, r->status: 304


And the request:

wget --header --server-response http://server/content.file
--04:28:56--
http://server/content.file    => `content.file'
Resolving server... ***.***.***.***
Connecting to server|***.***.***.***|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 304 Not Modified
  Date: Tue, 28 Apr 2009 08:22:33 GMT
  Server: ** upstream server tokens **
  Connection: Keep-Alive
  Keep-Alive: timeout=5, max=100
  ETag: "** etag **" 
  Expires: Mon, 06 Apr 2009 08:07:45 GMT
  Cache-Control: max-age=259
04:28:56 ERROR 304: Not Modified.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to