You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by J Channel <jc...@gmail.com> on 2009/05/01 16:50:32 UTC

Apache 2.2, mod_jk, env variables, version incompatibility, undocumented

This config work ok with apache 1.3

<VirtualHost *:8289>
   ServerName www.localhost.com

   RewriteEngine on
   RewriteLog "/opt/logs/httpd_rewrite_log"
   RewriteLogLevel 2

   AddType application/octet-stream .mht
   AddType text/html .shtml
   AddType application/vnd.ms-excel .xls
   AddHandler server-parsed .shtml
   AddDefaultCharset WINDOWS-1251

   ServerAdmin admin@localhost.com
   DocumentRoot /opt/public_html
   DirectoryIndex index.shtml

   <Directory "/opt/public_html">
       Options Indexes FollowSymLinks +Includes
       RewriteEngine on
       RewriteRule ^book/index.my.* ssi/test.shtml [L]
       AllowOverride None
       Order allow,deny
       Allow from all
   </Directory>
   JkMount /book/* balancer

</VirtualHost>

test.shtml contain a simple code <!--#echo var='REDIRECT_URL' -->
In browser we can see /book/index.my text by the address
localhost.com/book/index.shtml

But with apache 2.2.11 RewriteRule inside Directory section just
ignored, so we give tomcat error page on this address.

I get working rewrite rules under apache 2.2 by this configuraton:

   <Directory "/opt/public_html">
       Options Indexes FollowSymLinks +Includes
       AllowOverride None
       Order allow,deny
       Allow from all
   </Directory>
   RewriteRule ^/book/index.my.* /ssi/test.shtml [L,PT]
   JkMount /book/* balancer

Draw attention to first slash at ^/book and /ssi and flag PT in
RewriteRule, that placed now in virtualhost context -  this rule
working only in that case under apache 2.2 for me.
Where can i read about this stranges requirements?

Anyway history not ended as yet. =))
At present on page localhost.com/book/index.shtml i see text (none).
The variable REDIRECT_URL is very useful for my website and im sad
without her. Any ideas?

UPD:
This give me what i want:

   <Directory "/opt/public_html">
       Options Indexes FollowSymLinks Includes
       RewriteEngine On
       RewriteRule ^book/index.my.* ssi/test.shtml [L]
       AllowOverride None
       Order allow,deny
       Allow from all
   </Directory>

   <Location /book/>
       SetHandler jakarta-servlet
       SetEnv JK_WORKER_NAME balancer
       SetEnvIf SCRIPT_NAME !"^/book" no-jk
   </Location>

Looks like a cheat, but working =)
So, you comments are welcome.