You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Roger <cr...@cox.net> on 2004/10/17 21:24:20 UTC

[users@httpd] Stuck trying to mod_disk_cache local cgi content

Hi,

I have a python cgi application which modifies .jpg files on the fly. I 
am trying to implement disk caching for these images. I am running 
Windows/XP with Apache 2.0.52.

The html pages created refer to the images as if they were .jpg images 
and I use a rewrite rule to transform the request into a cgi get 
request. So my first change was to just change the rewrite rule to force 
a proxy request:
    RewriteRule (^/dra/DRA_.*)___(.*)_(.*)(\.jpg$) 
http://mysite.org/webkit/dra/ShowPix\?pid=$2\&tn=$3 [P,L]

(The original purpose of the above rule was to provide a pretty default 
file name should the user right-click and do a save as.)

Per the docs, I loaded the modules and created the proxy and disk 
caching statements:
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule cache_module modules/mod_cache.so

    ProxyRequests Off
    <ProxyMatch .*>
        Order deny,allow
        Allow from all
    </ProxyMatch>
    LoadModule disk_cache_module modules/mod_disk_cache.so
        CacheRoot c:/ApacheCache
        CacheSize 1000000
        CacheEnable disk /
        CacheDirLevels 5
        CacheDirLength 3

The result of the above is that Apache is caching some local .css, and 
.js files but is not caching the .jpg files covered by the rewrite rule. 
I plan on turning off the .css and .js caching with the proxymatch 
directive later.

The script creating the .jpg images puts out headers for 
('cache-control','max-age=3600') and the browsers I am testing with (IE, 
Mozilla, Opera) all cache the images successfully. So everything appears 
to be working OK except the .jpg files are not cached by Apache.

Anyone have a clue as to what I am doing wrong?

Roger


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Stuck trying to mod_disk_cache local cgi content

Posted by Roger <cr...@cox.net>.
Robert Andersson wrote:

> Roger wrote:
>
>> The result of the above is that Apache is caching some local .css, 
>> and .js files but is not caching the .jpg files covered by the 
>> rewrite rule. I plan on turning off the .css and .js caching with the 
>> proxymatch directive later.
>>
>> The script creating the .jpg images puts out headers for 
>> ('cache-control','max-age=3600') and the browsers I am testing with 
>> (IE, Mozilla, Opera) all cache the images successfully. So everything 
>> appears to be working OK except the .jpg files are not cached by Apache.
>
>
> Are you setting the "Last-modified" header when generating the images? 
> It might help. Most caches requires it, although I don't know about 
> the module.
>
> Regards,
> Robert Andersson
>
 No, I was not. I added Last-Modified headers, then Date headers, and 
finally threw in public and s-maxage into Cache-Control for good measure 
after the addition of Last-Modified had no effect. But the results 
remain the same.

After reading the rewriterule doc a second time, I concluded the [P] 
flag was only meant for caching data from external sites and is not 
needed for locally generated data.

I noticed there is another thread that says disk caching does not work 
on 2.0.52, but did work on 2.050. I moved from 2.0.48 to 2.0.52 after I 
encountered the problem.  While the other thread indicates there is no 
disk caching, I am seeing static .js and .css files and even some .jpg 
logo files cached by Apache 2.0.52.

Roger


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Stuck trying to mod_disk_cache local cgi content

Posted by Robert Andersson <ro...@profundis.nu>.
Roger wrote:
> The result of the above is that Apache is caching some local .css, and .js 
> files but is not caching the .jpg files covered by the rewrite rule. I 
> plan on turning off the .css and .js caching with the proxymatch directive 
> later.
>
> The script creating the .jpg images puts out headers for 
> ('cache-control','max-age=3600') and the browsers I am testing with (IE, 
> Mozilla, Opera) all cache the images successfully. So everything appears 
> to be working OK except the .jpg files are not cached by Apache.

Are you setting the "Last-modified" header when generating the images? It 
might help. Most caches requires it, although I don't know about the module.

Regards,
Robert Andersson 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org