Hi,
I think I've found a small bug in mod_jk relating to the way it handles 404
errors, though it's possible it's a configuration problem (but I don't think
so). Wondering if anyone can help?
In essence, we have a Centos 5.8 box running Apache 2.2.3-65 (as they call
it it's the latest version in the repositories), with mod_jk 1.2.37
(downloaded and built today, though had been running I think .32 before),
connecting to a Tomcat server on another machine running version 6.0.35.
The virtual server is setup with a JkMount /* mapping, so that everything is
by default passed to Tomcat, then several JkUnmount /*.extension mappings to
'unman' various static extensions I want Apache to handle directly (e.g.
*.png, *.php, *.pdf and so on).
The configuration is as follows:
#
# Generic Tomcat connector setup
#
JkWorkersFile /etc/httpd/conf/workers.properties
JkShmFile /var/log/httpd/mod_jk.shm
JkLogFile "|/usr/sbin/rotatelogs /var/log/httpd/mod_jk.log 86400"
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# Inside the virtual host setup
# Mount all to Tomcat
JkMount /* 1c
# Handle /blog locally
JkUnMount /blog/* 1c
# Handle images locally
JkUnMount /*.gif 1c
JkUnMount /*.jpg 1c
JkUnMount /*.jpeg 1c
JkUnMount /*.png 1c
JkUnMount /*.ico 1c
# Handle media locally
JkUnMount /*.txt 1c
JkUnMount /*.pdf 1c
JkUnMount /*.swf 1c
JkUnMount /*.flv 1c
# Handle JS/CSS locally
JkUnMount /*.js 1c
JkUnMount /*.css 1c
# Handle PHP locally
JkUnMount /*.php 1c
The problem can be seen on the actual website; if you make a request which
should generate a 404 response to a URL handled by Tomcat, all is well,
however if you make one that should be handled by Apache, you do get the 404
content (served, it turns out, by Tomcat not Apache), but a 200 response
code. This isn't ideal obviously. I know that the content is being served
by Tomcat because I have tried putting different 404 page content on Apache
and Tomcat and I always get the Tomcat version.
http://www.1cover.com.au/thiswill404 <- This is handled by Tomcat
http://www.1cover.com.au/thiswill404.css <- This should be handled by Apache
(but isn't) and gives a 200 response code
If I turn off the JkUnmount for, say, the css extension, then it is handled
by Tomcat and I get the correct 404 response code it seems that if you
JkUnmount an extension, and the file isn't found by Apache, it forwards to
Tomcat anyway but disregards the response from Tomcat?
Any help would be appreciated
Thanks
Pete