You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sebastian <s....@gmail.com> on 2008/11/07 10:44:29 UTC

mod_jk 1.2.27 use_server_errors extension not working here

Hello,

I'm in the process of integrating Tomcat with Apache httpd using the
mod_jk Tomcat Connector. The just released mod_jk 1.2.27 seems to
provide a solution for one of my open issues: the ability to use
httpd's ErrorDocument instead of Tomcat's default error pages or
<error-page> definitions from my webapp.

To use the new extension "use_server_errors" I switched from JkMount
statements in httpd.conf to JkMountFile and uriworkermap.properties
but I can't get it to work.

Here is what I tried so far on my way to this message:
- 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. If i set
this extension to -404 (see commented line in uriworkermap.properties
below) i get httpd's 503 ErrorDocument.

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).

I hope somebody already tried the new extension and can help me with
this problem.
Thanks,
Sebastian


Excerpts from my config files and version information follow below.

httpd.conf:
===========
LoadModule    jk_module  libexec/mod_jk.so.1.2.27
JkShmFile     /path/to/httpd/logs/mod_jk.shm
JkWorkersFile /path/to/httpd/conf/workers.properties

<VirtualHost host.example.com:9009>
    ServerName  example.com

    ErrorDocument 404 /errors/notfound.shtml
    ErrorDocument 401 /errors/unauthorized.shtml
    ErrorDocument 403 /errors/forbidden.shtml
    ErrorDocument 500 /errors/servererror.shtml
    ErrorDocument 503 /errors/servererror.shtml

    RewriteEngine   on
    RewriteLog      "logs/rewrite.log"
    RewriteLogLevel 9

    JkLogFile    /path/to/httpd/logs/mod_jk.log
    JkLogLevel   debug
    JkMountFile  /path/to/httpd/conf/uriworkermap.properties
    JkMountFileReload 0
</VirtualHost>

uriworkermap.properties:
========================
# Map /appname and everything below /appname/ to worker1
# all status codes >= 400 shall use ErrorDocument
/appname*=worker1;use_server_errors=400

# experiment (works as I expected):
# 404 from tomcat results in ErrorDocument 503
#/appname*=worker1;use_server_errors=400;fail_on_status=-404

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

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mod_jk 1.2.27 use_server_errors extension not working here

Posted by Rainer Jung <ra...@kippdata.de>.
Please open an issue in Bugzilla.

Sebastian schrieb:
> Hello,
> 
> I'm in the process of integrating Tomcat with Apache httpd using the
> mod_jk Tomcat Connector. The just released mod_jk 1.2.27 seems to
> provide a solution for one of my open issues: the ability to use
> httpd's ErrorDocument instead of Tomcat's default error pages or
> <error-page> definitions from my webapp.
> 
> To use the new extension "use_server_errors" I switched from JkMount
> statements in httpd.conf to JkMountFile and uriworkermap.properties
> but I can't get it to work.
> 
> Here is what I tried so far on my way to this message:
> - 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. If i set
> this extension to -404 (see commented line in uriworkermap.properties
> below) i get httpd's 503 ErrorDocument.
> 
> 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).
> 
> I hope somebody already tried the new extension and can help me with
> this problem.
> Thanks,
> Sebastian
> 
> 
> Excerpts from my config files and version information follow below.
> 
> httpd.conf:
> ===========
> LoadModule    jk_module  libexec/mod_jk.so.1.2.27
> JkShmFile     /path/to/httpd/logs/mod_jk.shm
> JkWorkersFile /path/to/httpd/conf/workers.properties
> 
> <VirtualHost host.example.com:9009>
>     ServerName  example.com
> 
>     ErrorDocument 404 /errors/notfound.shtml
>     ErrorDocument 401 /errors/unauthorized.shtml
>     ErrorDocument 403 /errors/forbidden.shtml
>     ErrorDocument 500 /errors/servererror.shtml
>     ErrorDocument 503 /errors/servererror.shtml
> 
>     RewriteEngine   on
>     RewriteLog      "logs/rewrite.log"
>     RewriteLogLevel 9
> 
>     JkLogFile    /path/to/httpd/logs/mod_jk.log
>     JkLogLevel   debug
>     JkMountFile  /path/to/httpd/conf/uriworkermap.properties
>     JkMountFileReload 0
> </VirtualHost>
> 
> uriworkermap.properties:
> ========================
> # Map /appname and everything below /appname/ to worker1
> # all status codes >= 400 shall use ErrorDocument
> /appname*=worker1;use_server_errors=400
> 
> # experiment (works as I expected):
> # 404 from tomcat results in ErrorDocument 503
> #/appname*=worker1;use_server_errors=400;fail_on_status=-404
> 
> 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

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org