Bug 37347 - mod_disk_cache replaces HTTP Status 301 with 200
mod_disk_cache replaces HTTP Status 301 with 200
Status: RESOLVED FIXED
Product: Apache httpd-2
Classification: Unclassified
Component: mod_cache
2.0.55
All All
: P2 major (vote)
: ---
Assigned To: Apache HTTPD Bugs Mailing List
: PatchAvailable
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2005-11-03 15:35 UTC by John Stefani
Modified: 2007-11-25 03:54 UTC (History)
0 users



Attachments
Patch against 2.0.x branch (571 bytes, patch)
2005-11-03 20:01 UTC, Ruediger Pluem
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Stefani 2005-11-03 15:35:41 UTC
this is the same as 23550 except it applies to mod_disk_cache and does not occur
in mod_mem_cache (so excuse the copying of the well stated report)

When apache is configured as a reverse proxy with mod_disk_cache enabled (or
both mod_disk_cache and mod_mem_cache but not with mod_mem_cache alone), it will
cache 301 responses from the backend. 

Now, when we hit the memory-cached object, mod_disk_cache returns the original
301 response with a replaced HTTP status of 200. This causes clients to not
follow the redirect.

I will try to illustrate this:

request:
    GET /foo HTTP/1.1
    Host: www.foo.tld

1st response, before caching:
    HTTP/1.1 301 Moved Permanently
    Location: http://www.foo.tld/foo/

subsequent response, on same request:
    HTTP/1.1 200 OK
    Location: http://www.foo.tld/foo/

=> Client ignores Location: header
Comment 1 Ruediger Pluem 2005-11-03 20:01:17 UTC
Created attachment 16870 [details]
Patch against 2.0.x branch

This has been fixed in trunk and 2.2.x a while ago (r220038). Can you please
give the attached patch a try? It should fix the problem for mod_disk_cache and
for mod_mem_cache
Comment 2 John Stefani 2005-11-03 21:42:29 UTC
Thank You,

the patch you supplied fixed the issue.

Are there any plans to merge it into the 2.0.x code?

Comment 3 Ruediger Pluem 2005-11-03 22:16:10 UTC
Thanks for testing. I proposed it for backport to 2.0.x by adding it to the
STATUS file:
http://svn.apache.org/viewcvs.cgi/httpd/httpd/branches/2.0.x/STATUS?p2=%2Fhttpd%2Fhttpd%2Fbranches%2F2.0.x%2FSTATUS&p1=httpd%2Fhttpd%2Fbranches%2F2.0.x%2FSTATUS&r1=330635&r2=330634&rev=330635&view=diff&makepatch=1&diff_format=u

I reopen the bug and will close it again once the patch has been backported.
Comment 4 Takashi Sato 2007-11-25 03:54:34 UTC
fixed as r372047
http://svn.apache.org/viewvc?view=rev&revision=372047