You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Hansjoerg Pehofer <ha...@uibk.ac.at> on 2005/07/07 16:53:47 UTC

Re: mod_cache caching the 301 Moved Permanently

Hi,

it has been some time since the original thread.
This is in reply to [1].

 
Sander Striker wrote:
>> r.pluem@t-online.de wrote:
>> The problem seems to be, that the proxied backend server that is
>> cached via mod_disk_cache originally
>> delivers HTTP status 301 and the Location
>> http://www.beach-clothing.com/where-to-buy/, but once cached
>> mod_disk_cache delivers HTTP status 200 instead of 301 (but
>> correctly redelivering the Location header).
>> I have not proved this for myself so far, but this seems the problem
>> to me.

>This wouldn't surprise me one bit.  The 2.1 branch has seen quite a
>bit of churn in this
>area.

>Any chance you could give 2.1 a go and see if that works correctly?

It is the same problem as described in issue 32226 [2].
Unfortunately, the described behavior is still present in both httpd
2.0.54 and 2.1.6-alpha with mod_disk_cache active. I can not reproduce 
it with 2.1.6-alpha and mod_mem_cache.

Tested with the following setup:

 Frontend:
 httpd 2.1.6-alpha on 127.0.0.1, cache, disk_cache and proxy* modules
 loaded, out of the box httpd.conf plus:

 CacheRoot /cache/alpha
 CacheEnable disk /
 CacheDirLevels 1
 CacheDirLength 2

 ProxyPass        /  http://backend.tld/
 ProxyPassReverse /  http://backend.tld/

 Backend:
 Apache 1.3, a file cachetest/gonk/index.html relative to DocumentRoot.


A first request to the Proxy (GET /cachetest/gonk) correctly responds in
301ing to /cachetest/gonk/ first -- and then getting the index document.
  
There are 2 .data/.header couples in the cachedir at this point (the
redirect-message and the index document ).

A second request with a second client, or if the browser's cache has 
been cleared, returns the cached "Moved Permanently" message with 
status 200.  This message contains a link in the backend's view of the
URLs (as discussed in the original thread).

The /cache/alpha/Kx/lZGs_@eMqfu9BZQZTN4g.header Cache File contains:

  ^B^@^@^@-^A^@^@^Y^@^@^@^@^@^@^@@-a<89>Nû^C^@@Žô<8C>Nû^C^@MYh<89>Nû^C^@®qh<89>Nû^C^@127.0.0.1/cachetest/gonk?Date: Thu, 07 Jul 2005 12:34 :21 GMT
  Server: Apache
  Location: http://127.0.0.1/cachetest/gonk/
  Content-Type: text/html; charset=iso-8859-1
  Expires: Thu, 07 Jul 2005 12:35:21 GMT

  Host: 127.0.0.1
  User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8)
  Gecko/20050513 Debian/1.7.8-1
  Accept:
  text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
  Accept-Language: de-at,de;q=0.8,en;q=0.5,it;q=0.3
  Accept-Encoding: gzip,deflate
  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  Max-Forwards: 10
  X-Forwarded-For: 127.0.0.1
  X-Forwarded-Host: 127.0.0.1
  X-Forwarded-Server: 127.0.0.1

[3], which is an attachment to [2] contains a fragment that keeps 
mod_cache.c from handling redirects at all -- if i understood it right,
however it works for us.  This is probably only the second best i
approach, since 301 is cacheable.

Regards,
Hansjörg

References:
[1] http://mail-archives.apache.org/mod_mbox/httpd-dev/200504.mbox/%3c426967CB.1030500@apache.org%3e 
[2] http://issues.apache.org/bugzilla/show_bug.cgi?id=32226
[3] http://issues.apache.org/bugzilla/attachment.cgi?id=13433 

-- 
IT Services                University of Innsbruck    
CFB4 D6E7 33F4 34C0 18B9  6661 E355 4337 3F8B D9C2
 http://purl.org/net/hansjoerg.pehofer/public_key

Re: mod_cache caching the 301 Moved Permanently

Posted by r....@t-online.de.
Have you checked http://mail-archives.apache.org/mod_mbox/httpd-dev/200504.mbox/%3c4269705A.5060001@gmx.de%3e   ?

It contains a small patch which was not discussed any further here.

Regards

Rüdiger

Hansjoerg Pehofer wrote:
> Hi,
> 
> it has been some time since the original thread.
> This is in reply to [1].