httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Devendra Singh>
Subject Re: mod_cache caching the 301 Moved Permanently
Date Fri, 22 Apr 2005 05:16:55 GMT
At 21/04/05 10:04 (), Devendra Singh wrote:
>I am writing to the Developer List because I did not get any response on 
>the Users List and thought that the topic might be relevant to the dev list.
>If a request comes for a directory w/o trailing slash, it gets cached and 
>the subsequent requests see:
>Moved Permanently
>The document has moved here
>for try to access the URL:
>The configuration has two apache 2.0.53. The one running on port 80 has 
>mod_disk_cache which sends requests to 8080 via ProxyPassReverse.
>Here is my Virtual Host Config:
>Apache on Port 80:
>DocumentRoot /var/www/public_html/beach-clothing
>ServerPath /beach-clothing
>RewriteEngine On
>RewriteCond %{HTTP_HOST}   !^www\.beach-clothing\.com [NC]
>RewriteCond %{HTTP_HOST}   !^$
>RewriteRule ^/(.*)$1 [L,R=301]
>#Enable Caching
>CacheDisable /index.html
>CacheEnable disk /
>RewriteCond %{SERVER_PORT} ^25$
>RewriteRule /* - [F]
>RewriteRule ^(.*)\/$ $1/index.html [P]
>RewriteRule \.(gif|jpg|png|txt|css|js|ico|swf)$ - [last]
>RewriteRule ^/(.*)$$1 [proxy]
>ProxyPassReverse /
>Apache on port 8080:
>DocumentRoot /var/www/public_html/beach-clothing
>#Enable Caching for 48 Hours
><Location /cgi>
>         ExpiresActive off
><FilesMatch "\.(mp|pl|cgi)$">
>         ExpiresActive off
><Location />
>         ExpiresActive on
>         ExpiresByType text/html A432000
>UseCanonicalName is off into the Server Config Section of both the Apache.
>How do I solve this problem? If anyone has any clue / pointer?


Sorry, replying my own post.

I modified the "modules/experimental/mod_cache.c" (around line 374) to 
eliminate the caching of HTTP_MOVED_PERMANENTLY and the problem was solved.

      * what responses should we not cache?
      * At this point we decide based on the response headers whether it
      * is appropriate _NOT_ to cache the data from the server. There are
      * a whole lot of conditions that prevent us from caching this data.
      * They are tested here one by one to be clear and unambiguous.
     if (r->status != HTTP_OK && r->status != HTTP_NON_AUTHORITATIVE
         && r->status != HTTP_MULTIPLE_CHOICES
         && r->status != HTTP_MOVED_PERMANENTLY --> Remove this line.
         && r->status != HTTP_NOT_MODIFIED) {
         reason = apr_psprintf(p, "Response status %d", r->status);

Please comment, is this a right approach?


Devendra Singh

View raw message