tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johann Hanne <>
Subject [patch] [rfc] mod_jk: Use Apache's REMOTE_USER variable for ajp
Date Fri, 03 Aug 2007 11:36:24 GMT

I currently have the following requirement:
- "Include" a JSP script within a PHP script
- Let PHP do the authentication

My first try was to use mod_jk, PHP's virtual() command (which triggers Apache 
subrequests) and Apache authentication (although I actually need to let PHP 
do the authentication).

This worked with the following problems:
- I had to configure "AuthType Basic" twice: Once for the directory where the 
PHP script resides (using .htaccess) and once for the virtual path controlled 
with JkMount (using <Location> in a global configuration file which only adds 
bloat to it)
- Apache authentication is not what I wanted and I could not control the 
username which is passed to tomcat within the PHP script

The attached patch modifies mod_jk in order to use the "REMOTE_USER" 
environment variable instead of the "user" field in the request structure. 
This improves two things:
- Configuring "AuthType Basic" for the JkMount path is no longer required, 
i.e. it's sufficient to configure authentication for the PHP script
- The username passed to tomcat can be modified in the PHP script 
using 'apache_setenv("REMOTE_USER", "fakeduser");' before the virtual() call

Comments, please?

Cheers, Johann

View raw message