Bug 46169 - mod_jk extension use_server_errors not working
Summary: mod_jk extension use_server_errors not working
Status: RESOLVED FIXED
Alias: None
Product: Tomcat Connectors
Classification: Unclassified
Component: mod_jk (show other bugs)
Version: 1.2.27
Hardware: Other Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-07 08:16 UTC by Sebastian Hilbig
Modified: 2008-12-12 06:40 UTC (History)
0 users



Attachments
Patch making use_server_errors work with httpd 1.3 (1.45 KB, patch)
2008-11-07 09:40 UTC, Rainer Jung
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Hilbig 2008-11-07 08:16:08 UTC
The just released mod_jk 1.2.27 provides the new extension "use_server_errors" to use Apache httpd's ErrorDocument instead of Tomcat's default error pages or <error-page> definitions in the webapp.

I configured the extension in uriworkermap.properties:
/appname*=worker1;use_server_errors=400

ErrorDocument und JkMountFile directives are in an Apache <VirtualHost>.

Here is what I tried so far on my way to this bug report:
- no <error-page> in web.xml = Tomcats default 404 page
- <error-page> in web.xml using an empty file in my webapp as
  location = Empty page
- experiment with fail_on_status extension, which does work. This uriworkermap entry results in httpd's 503 ErrorDocument: /appname*=worker1;use_server_errors=400;fail_on_status=-404

I had to compile mod_jk from source and so I took a peek at the source and added some debug logging in jk_ajp_common.c/ajp_process_callback() and jk_uri_worker_map.c/uri_worker_map_add() to dig a little deeper.

Note: I'm far from grasping the whole mod_jk and so the following analysis might be completely off, but maybe I'm on the right track and we can progress from here.

The logging seems to confirm that my configuration is processed correctly but I found two issues and stopped there:
1. In ajp_process_callback() the value of r->extension.use_server_error_pages is 0 and not 404 as i expected.
The response from Tomcat is therefore not blocked here and send to the client.
2. If I hard code r->extension.use_server_error_pages = 404 in ajp_process_callback() the response is blocked but apperently httpd does not pick up and send it's ErrorDocument so the client waits with a blank window (and seems to get a http status code 200).

Version information:
====================
- Tomcat: 6.0.18
- mod_jk: 1.2.27 (compiled from source, only configure option was
--with-apxs=/path/to/apxs)
- httpd: 1.3.34
- JDK: 1.6.0_07
- OS: Linux Debian 4.0 "Etch" Stable
Comment 1 Rainer Jung 2008-11-07 09:21:49 UTC
The feature is currently not implemented for httpd 1.3, only for 2.0 and 2.2.
We'll look into it. If it is simple, we'll backport it, if not that might be another good reason to finally leave httpd 1.3 behind you.

Thanks for reporting the issue.
Comment 2 Rainer Jung 2008-11-07 09:40:18 UTC
Created attachment 22842 [details]
Patch making use_server_errors work with httpd 1.3

Patch based on version 1.2.27.
Comment 3 Rainer Jung 2008-11-07 09:44:56 UTC
You can test the patch, it is small and I committed it right now as revision r712207.

Will be part of 1.2.28.

Nevertheless consider upgrading to httpd 2.2 ;)
Comment 4 Mark Thomas 2008-11-07 09:59:43 UTC
This is a test - please ignore. Sorry for the noise.

worker1
Comment 5 Sebastian Hilbig 2008-11-10 01:44:22 UTC
(In reply to comment #3)
> You can test the patch, it is small and I committed it right now as revision
> r712207.
> 
> Will be part of 1.2.28.

I just integrated and tested the patch and it works as expected.

> Nevertheless consider upgrading to httpd 2.2 ;)

We're not only considering but already planning the upgrade :)
But that will take some time and we needed to integrate Tomcat sooner, so thanks a lot for the quick response and patch!
Comment 6 Mark Thomas 2008-12-12 04:16:02 UTC
r1=123456

More bz/svn testing. Again, sorry for the noise/
Comment 7 Mark Thomas 2008-12-12 06:40:04 UTC
Hopefully the last if my testing:

r1=

r1