DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=30398>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=30398 Wrong content type when using mod_jk with mod_cache Summary: Wrong content type when using mod_jk with mod_cache Product: Tomcat 5 Version: 5.0.18 Platform: PC OS/Version: Linux Status: NEW Severity: Normal Priority: Other Component: Native:JK AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Hi, I discovered a problem with the cooperation between mod_jk and Apache 2.0's mod_cache. I discovered the problem while I tried to cache Tomcat responses delivered by mod_jk with mod_cache. At the first look everything works fine and the content is served and cached, but after the content is cached the content type of the cache delivered content is always set to text/plain regardless of the content type of the original Tomcat delivered content. My environment: Apache: 2.0.50 mod_jk: 1.2.5 OS: Linux Tomcat: 5.0.18 Excerpt from my Apache configuration: <VirtualHost 192.168.2.4:80> ServerName www.something.de ServerAdmin [EMAIL PROTECTED] DocumentRoot "/var/httpd/test/www.something.de/docs" ErrorLog "|/opt/apache-2.0.50/bin/rotatelogs /var/httpd/test/www.something.de/lo gs/error_log 86400" CustomLog "|/opt/apache-2.0.50/bin/rotatelogs /var/httpd/test/www.something.de/l ogs/access_log 86400" combined <Directory /var/httpd/test/www.something.de/docs> Options None AllowOverride None </Directory> JkMount /* worker_ajp13 CacheRoot /var/httpd/test/cache CacheSize 256 CacheEnable disk /test CacheDirLevels 5 CacheDirLength 3 CacheMaxExpire 60 CacheIgnoreNoLastMod On CacheIgnoreCacheControl On CacheDefaultExpire 60 </VirtualHost> I believe that I found the reason for this, but I am not quite sure if it is a bug of mod_disk_cache or mod_jk. Maybe a separate discussion for the core developers :-). mod_disk_cache stores the content type of a cached response together with the other headers of this response in a separate file (write_headers). For storing the Content-Type it reads the information only from the headers_out table and not from the content_type field in the request_rec structure. On the other hand mod_jk's ws_start_response only sets the content type via ap_set_content_type (thus only setting the content_type field) and does not add the header Content-Type to the headers_out table. To cut a long story short, the following patch to mod_jk.c (Apache 2.0 version) fixes this problem: --- jakarta-tomcat-connectors-jk-1.2.5-src/jk/native/apache-2.0/mod_jk.c.orig 2003-09-06 17:37:20.000000000 +0200 +++ jakarta-tomcat-connectors-jk-1.2.5-src/jk/native/apache-2.0/mod_jk.c 2004-07-29 12:34:40.000000000 +0200 @@ -254,6 +254,8 @@ /* and it make jk useable with deflate using */ /* AddOutputFilterByType DEFLATE text/html */ ap_set_content_type(r, tmp); + apr_table_set(r->headers_out, + header_names[h], tmp); } else if(!strcasecmp(header_names[h], "Location")) { #ifdef AS400 /* Fix escapes in Location Header URL*/ The diff is against 1.2.5 but it is also applicable against 1.2.6. Another approach to solve this problem would be to adjust write_headers in mod_disk_cache.c of Apache 2.0 accordingly, but as said above the discussion of the correct approach is another story, where I cannot distribute anything. Regards Rüdiger Plüm --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]