You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jerry Malcolm <2n...@gmail.com> on 2011/12/27 16:48:05 UTC

[users@httpd] mod_rewrite / mod_jk not working together

I have an established environment of Apache 2.2 and Tomcat 7.  I've had
mod_jk working without problem for years.  I have a need to add some
user-friendly URLs.  So I added mod_rewrite to the picture.

Here's the problem... I have a very simple rewrite rule that maps /test to
/abc.jsp.  I have a mod_jk mount statement to send *.jsp to Tomcat.  When I
send "/test" in, mod_rewrite does the mapping as expected. I looked in the
rewrite log file.  The log file says it matches and converts. (I did a
quick check and mapped to a jpg and did indeed get the mapped jpg back...
so it appears mod_rewrite is working fine).  But when the request gets to
mod_jk, it's the original URL - /test, which obviously does not match the
*.jsp and therefore does not send to Tomcat.

I'm new to mod_rewrite.  So I'm obviously missing something.  I thought I
could use it as simply a URL converter that sits in front of everything in
Apache and maps one URL to another, and everything downstream in Apache
(i.e. mod_jk) would see the mapped URL as if that was the URL that came
from the browser.

So mod_rewrite works fine; mod_jk works fine.  They just appear to both be
seeing the original input URL.

What am I missing?  How do I make mod_jk use the mapped URL from
mod_rewrite?  (And send the mapped URL on to Tomcat instead of sending the
original URL)?

Thanks

Jerry

Re: [users@httpd] mod_rewrite / mod_jk not working together

Posted by Rainer Jung <ra...@kippdata.de>.
On 27.12.2011 17:12, Eric Covener wrote:
>> What am I missing?  How do I make mod_jk use the mapped URL from
>> mod_rewrite?  (And send the mapped URL on to Tomcat instead of sending the
>> original URL)?
>
> The PT flag, but there is also a mod_jk bug or config element that can
> prevent that from working IIRC.

Correct, apart from the needed [PT] flag for the RewriteRule there are 
old outdated mod_jk config snippets floating in the web containing

JkOptions     +ForwardURICompatUnparsed

which is garbage. With non-antique mod_jk versions (>=1.2.24), it is 
best to remove any ForwardURI* JkOption.

Jerry: you might want to read about it on

http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html

and

http://tomcat.apache.org/connectors-doc/generic_howto/proxy.html

Regards,

Rainer


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite / mod_jk not working together

Posted by Eric Covener <co...@gmail.com>.
> What am I missing?  How do I make mod_jk use the mapped URL from
> mod_rewrite?  (And send the mapped URL on to Tomcat instead of sending the
> original URL)?

The PT flag, but there is also a mod_jk bug or config element that can
prevent that from working IIRC.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org