You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jarecsni János <ja...@chello.hu> on 2002/02/14 18:15:17 UTC

Apache+Tomcat and the RewriteRule

Hi,

how can I use Apache mod_rewrite to alias a dynamic resource (to be served
by tomcat thru ajp)???

    RewriteRule !^/istore(.*) - [C]
    RewriteRule (.*) http://my.virtual.host/istore$1 [L]

is not good since it handles the URL as a file after rule is matched (so it
prepends the document root, instead of passing the request to Tomcat [I have
the appropriate JkMounts]).

(2) init rewrite engine with requested uri /control/main
(3) applying pattern '^/istore(.*)' to uri '/control/main'
(3) applying pattern '(.*)' to uri '/control/main'
(2) rewrite /control/main -> http://my.virtual.host/istore/control/main
(3) reduce http://my.virtual.host/istore/control/main ->
/istore/control/main
(2) local pathresult: /istore/control/main
(2) prefixed with document_root to
f:/jboss-2.4.4_tomcat-4.0.2b/jboss/deploy/istore.war/istore/control/main
(1) go-ahead with
f:/jboss-2.4.4_tomcat-4.0.2b/jboss/deploy/istore.war/istore/control/main
[OK]

I tried the [P] flag to proxy it:

    RewriteRule !^/istore(.*) - [C]
    RewriteRule (.*) http://my.virtual.host/istore$1 [P]

So we redirect the newly rewritten URL to ourselves back, for another round
of processing (which in deed will activate tomcat). The problem: cookies are
lost with this approach.

I tried a few other lists and archives but found absolutely nothing.

thanks
János

--
Jarecsni, János
MORGAN HILL CONSULTING, Internet Applications Unit
mailto:Jarecsni.Janos@morganhillconsulting.hu
http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>