tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <>
Subject Re: Apache mod_jk SetEnvIf negative look ahead not working
Date Tue, 23 Jun 2009 15:05:40 GMT

On 22.06.2009 06:10, as2 wrote:
> Hi,
> I am trying to add a rule .. some thing like this
> <LocationMatch "/app/">
>   SetHandler jakarta-servlet
>   SetEnvIf REQUEST_URI "\.(jsp|htm?)$" JK_WORKER_NAME=default
>   SetEnvIf REQUEST_URI ^(/app/dir/([^/]*)/(?!jsp))   no-jk
> </LocationMatch> 
> I am having problem with this line
> SetEnvIf REQUEST_URI ^(/app/dir/([^/]*)/(?!jsp))    no-jk
> I want to use no-jk only when the request URI does not contain
> /app/dir/*/jsp/ path. This works with ruby, but now working with apache
> mod_jk. Is there a way to make negative expression work in mod_jk

Did you try with the latest jk version (1.2.28)?

Not sure, what exactly works with ruby, but mod_jk doesn't know anything
about SetEnvIf and negative look ahead. It only checks, whether the
"no-jk" Apache environment variable is set, and if so, it doesn't
forward the request and instead lets Apache handle it itself.

You can check the value of "no-jk" by adding %{no-jk}e to your LogFormat
used in the CustomLog.

> And also I would like to add another expression that checks if the folder
> (that does not contain /jsp/ folder)  contains file with jsp extenstion so
> that use JK_WORKER_NAME=$1 instead of no-jk

You can use mod_rewrite for such things. Mod_rewrite can check for file
existence and can also use back references when setting env vars.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message