Hi Rainer,

I have been playing around with mod_rewrite, but as far as I can tell the rewrite is done before the jkmount. So I can get this wonderful url to be rewritten to the actual name of the web application, but since the old and the new versions have the same name it will not work. For a moment I thought it might have something to do with the forwarding rules of mod_jk, but as far as I can tell the standard option is ForwardURIProxy which means it sends the rewritten rule to tomcat instead of the original one.

It would be wonderful if there would exist something to manipulate the url after is being forwarded with jkmount (or anything else that could help me get the results needed :) )

Rainer Jung wrote:
Hi Edwin,

Edwin Walsh wrote:
Hi,

First of all I would like to mention that this is my first post on this list, I hope that this question is posted in the right place. I have tried finding a solution for my problem, but it either doesn't exist, or my limited brain can't manage to figure out how to do it (I strongly hope it is the latter)

In fact the solution to the problem is non-trivial :)

The situation is the following:
Currently we have several web applications running on a Tomcat 6 server. For the sake of this explanation I will call then web1 and web2. I have apache set up to use jkmount to forward requests from the apache server to the tomcat server. The problem is that I can only get apache to forward things like www.esat.kuleuven.be/web1 and www.esat.kuleuven.be/web2.

I would like to be able to forward things like www.esat.kuleuven.be//somefancyname//web1 to the same application on the Tomcat server.

I know this is possible with ProxyPassReverse in apache, but I would like to be able to do this with jkmount so that I keep the possibility to easily jump to a backup server if the main server goes down (Tomcat crashes more often for us then the http server does).

To add to the problem, the web applications I am talking about are updates from earlier versions. We still have the older versions running on older versions of Tomcat and the forwarding rules of www.esat.kuleuven.be/web1 need to continue to point to the old server.

As far as I can tell using the location tag in the apache conf file will not help since it seems to me that jkmount takes that location as a parameter to forward to Tomcat. And since my application is called web1 and not somefancyname/web1 it cant find it in the web applications folder.

Using a subdomain in a virtualhost could probably fix the problem in a way that I could use /somefancyname/.esat.kuleuven.be/web1 for the new web application, but it is very unlikely that our system administrators will allow us to set up this subdomain. And even if they would it isn't really the url I was hoping for.

So in sumary, what I would like is 2 types of links:
www.esat.kuleuven.be/web1 to point to the older web application
www.esat.kuleuven.be//somefancyname//web1 to point to the new web application (both have the same name but are on a different tomcat server)

I think the solution should have 2 ingredients:

1) Make sure, that /web/ and /something/web match different JkMounts

JkMount /web1|/* oldworker
JkMount /?*/web1|/* newworker

"?" matches one character, so the second rule won't match /web1/..., except for "/web1/.../web1/..."

The "|" character is a shortcut form for 2 rules in one:

JkMount /web1|/* oldworker

is equivalent to

JkMount /web1 oldworker
JkMount /web1/* oldworker

2) Rewrite request to remove "/something" before forwarding

Have a look at mod_rewrite. With mod_rewrite you can change the URL with a pattern based syntax. In order to forward the changed URL and not the original URL through mod_jk, you need to also set the pass through flag "[PT]" in mod_rewrite

Now the only thing I'm not sure at the moment is, if in case you rewrite the URL via mod_rewrite, the JkMounts are handeled before the rewrite (then this should work) or after (then it would obvisouly not).

Play around a bit with the ideas, set JkLogLevel to debug and use a RewriteLog with a high level, so you can follow the URL manipulation and mapping in the log.

If rewrite is done before JkMount, we'll have another solution :)

Any help would be welcome.
With kind regards,
Edwin

Regards,

Rainer

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to