Hi,
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: http://www.beach-clothing.com/where-to-buy
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: <VirtualHost 66.235.181.69> ServerAlias beach-clothing.com www.beach-clothing.com ServerName www.beach-clothing.com ServerAdmin [EMAIL PROTECTED] DocumentRoot /var/www/public_html/beach-clothing ServerPath /beach-clothing RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.beach-clothing\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) http://www.beach-clothing.com/$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 ^/(.*)$ http://www.beach-clothing.com:8080/$1 [proxy] ProxyPassReverse / http://www.beach-clothing.com:8080/ </VirtualHost>
Apache on port 8080: <VirtualHost 66.235.181.69> ServerAlias beach-clothing.com www.beach-clothing.com ServerName www.beach-clothing.com ServerAdmin [EMAIL PROTECTED] DocumentRoot /var/www/public_html/beach-clothing #Enable Caching for 48 Hours <Location /cgi> ExpiresActive off </Location> <FilesMatch "\.(mp|pl|cgi)$"> ExpiresActive off </FilesMatch> <Location /> ExpiresActive on ExpiresByType text/html A432000 </Location> </VirtualHost>
UseCanonicalName is off into the Server Config Section of both the Apache.
How do I solve this problem? If anyone has any clue / pointer?
Hi,
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?
Thanks.
Devendra Singh
