You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Simon MARTIN <si...@gmx.at> on 2004/12/29 04:25:18 UTC

Forwarding *all* webapps with mod_jk

Hi,

I've integrated Tomcat successfully into Apache using mod_jk, but there's 
something I've found nothing about: forwarding *all* webapps with only one 
static statement in the configuration files.

I've thought about something like this:

JkMount /tomcat/* ajp13:*  (which of course is wrong I know)

So, everything called like /tomcat/webApp from Apache should be forwarded to 
Tomcat -- but without the /tomcat at the beginning (as Tomcat of course does not 
find the webapp at /tomcat/ but would find it at /webApp).

Background is that I want to dynamically deploy my webapps, but I don't always 
want to modify any configuration file or restart Apache and / or Tomcat.

Thanks in advance and kind regards,
   Simon

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Forwarding *all* webapps with mod_jk

Posted by Mladen Turk <ml...@jboss.com>.
Wade Chandler wrote:
>>
>> You can use the mod_rewrite:
>> RewriteEngine On
>> RewriteRule   ^/tomcat/(.+)$  /$1 [R,L]
>> JkMount /* ajp13
>>
>> But this will map everything to the tomcat.
>>
>> You can not do (for now):
>> /tomcat/examples/* -> /examples/*
>> and then back to:
>> /examples/* -> /tomcat/examples/*
>>
>> This would require that mod_jk when forwarding the request
>> to Tomcat strips the '/tomcat' from the URL, and then
>> after receiving the response add the '/tomcat' prefix to
>> the url. Of course you will be forced to use only the
>> relative url's inside your application, so the usage
>> is dubious.
>>
> 
> #this will allow all rsg servlets to be run through tomcat.
> [uri:/*servlet*]
> info= for all servlets in a servlet directory
> context=/
>


You can use (for JK1.2.8)
JkMount /*/servlet/*

This was not possible on pre 1.2.8.

But I think he ment something else,
and that is dynamically rewriting the url with mod_jk.

For example:
JkMount /tomcat/* ajp13
JkMountPrefix /tomcat ajp13
Something like that would allow that for:
/tomcat/foo/* actuall requests to Tomcat are /foo/*

This still sounds to me somehow silly.
One can create a virtual host inside Apache and
redirect it to Tomcat ROOT so that for example
all requests to http://host are for the Apache,
and http://tomcat.host mapped with 'JkMount /* ajp13'

Mladen.









---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Forwarding *all* webapps with mod_jk

Posted by Wade Chandler <wc...@redesetgrow.com>.
Mladen Turk wrote:
> Simon MARTIN wrote:
> 
>> Hi,
>>
>> I've integrated Tomcat successfully into Apache using mod_jk, but 
>> there's something I've found nothing about: forwarding *all* webapps 
>> with only one static statement in the configuration files.
>>
>> I've thought about something like this:
>>
>> JkMount /tomcat/* ajp13:*  (which of course is wrong I know)
>>
> 
> You can use the mod_rewrite:
> RewriteEngine On
> RewriteRule   ^/tomcat/(.+)$  /$1 [R,L]
> JkMount /* ajp13
> 
> But this will map everything to the tomcat.
> 
> You can not do (for now):
> /tomcat/examples/* -> /examples/*
> and then back to:
> /examples/* -> /tomcat/examples/*
> 
> This would require that mod_jk when forwarding the request
> to Tomcat strips the '/tomcat' from the URL, and then
> after receiving the response add the '/tomcat' prefix to
> the url. Of course you will be forced to use only the
> relative url's inside your application, so the usage
> is dubious.
> 
> Mladen.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 

Could he not do something like this...doesn't mod_jk now have the 
mod_jk2 stuff in it?

I do this in mod_jk2 in the workers2.properties file

#this will allow all rsg servlets to be run through tomcat.
[uri:/*.jrsg]
info=jrsg (extension for RSG controller servlets)
context=/

I give all of my servlets an extension in their name.  Though I assume 
this could be done like:

#this will allow all rsg servlets to be run through tomcat.
[uri:/*servlet*]
info= for all servlets in a servlet directory
context=/

I then make sure that the native server has the same context/path what 
ever you want to call it as the tomcat web app will have.  This means 
the url path will be correct for both servers.
If I have /someapp in Apache or IIS then my webapp name will be /someapp 
and /someapp/servlets will house the servlets....

Can he not do something like this in mod_jk?  What would the equivalent 
be?  Also, if he isn't using the version of mod_jk which has the mod_jk2 
stuff merged in, I would still like to know if the merged version still 
has this capability?

Hope that might help, and thanks for any other info given to the list of 
a similar nature on the same topic.

Wade


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Forwarding *all* webapps with mod_jk

Posted by Mladen Turk <mt...@apache.org>.
Simon MARTIN wrote:
> Hi,
> 
> I've integrated Tomcat successfully into Apache using mod_jk, but 
> there's something I've found nothing about: forwarding *all* webapps 
> with only one static statement in the configuration files.
> 
> I've thought about something like this:
> 
> JkMount /tomcat/* ajp13:*  (which of course is wrong I know)
>

You can use the mod_rewrite:
RewriteEngine On
RewriteRule   ^/tomcat/(.+)$  /$1 [R,L]
JkMount /* ajp13

But this will map everything to the tomcat.

You can not do (for now):
/tomcat/examples/* -> /examples/*
and then back to:
/examples/* -> /tomcat/examples/*

This would require that mod_jk when forwarding the request
to Tomcat strips the '/tomcat' from the URL, and then
after receiving the response add the '/tomcat' prefix to
the url. Of course you will be forced to use only the
relative url's inside your application, so the usage
is dubious.

Mladen.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


SV: Forwarding *all* webapps with mod_jk

Posted by Swanthe Lindgren <sw...@ucr.uu.se>.
I have solved a similar problem using JkAutoAlias. I guess in your case it
would look something like

JkMount 	/tomcat/*	MyWorker
JkAutoAlias c:/server/tomcat_development/webapps 

You might notice that I'm running windows, but just replace the path to your
webapps and you should be up and running.

Swanthe Lindgren
Systemutvecklare
 
Uppsala Kliniska Forskningscentrum 


Swanthe Lindgren
Systemutvecklare
 
Uppsala Kliniska Forskningscentrum

-----Ursprungligt meddelande-----
Från: Harry Hartley [mailto:hhartley@pobox.com] 
Skickat: den 27 oktober 2005 11:57
Till: 'Tomcat Users List'
Ämne: RE: Forwarding *all* webapps with mod_jk

Ditto, 

Please let me know if you find a solution.

Harry

> -----Original Message-----
> From: Simon MARTIN [mailto:simon.martin@gmx.at]
> Sent: Wednesday, December 29, 2004 5:25 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Forwarding *all* webapps with mod_jk
> 
> Hi,
> 
> I've integrated Tomcat successfully into Apache using mod_jk, but 
> there's something I've found nothing about: forwarding *all* webapps 
> with only one static statement in the configuration files.
> 
> I've thought about something like this:
> 
> JkMount /tomcat/* ajp13:*  (which of course is wrong I know)
> 
> So, everything called like /tomcat/webApp from Apache should be 
> forwarded to Tomcat -- but without the /tomcat at the beginning (as 
> Tomcat of course does not find the webapp at /tomcat/ but would find 
> it at /webApp).
> 
> Background is that I want to dynamically deploy my webapps, but I 
> don't always want to modify any configuration file or restart Apache 
> and / or Tomcat.
> 
> Thanks in advance and kind regards,
>    Simon
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Forwarding *all* webapps with mod_jk

Posted by Harry Hartley <hh...@pobox.com>.
Ditto, 

Please let me know if you find a solution.

Harry

> -----Original Message-----
> From: Simon MARTIN [mailto:simon.martin@gmx.at]
> Sent: Wednesday, December 29, 2004 5:25 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Forwarding *all* webapps with mod_jk
> 
> Hi,
> 
> I've integrated Tomcat successfully into Apache using mod_jk, but there's
> something I've found nothing about: forwarding *all* webapps with only one
> static statement in the configuration files.
> 
> I've thought about something like this:
> 
> JkMount /tomcat/* ajp13:*  (which of course is wrong I know)
> 
> So, everything called like /tomcat/webApp from Apache should be forwarded
> to
> Tomcat -- but without the /tomcat at the beginning (as Tomcat of course
> does not
> find the webapp at /tomcat/ but would find it at /webApp).
> 
> Background is that I want to dynamically deploy my webapps, but I don't
> always
> want to modify any configuration file or restart Apache and / or Tomcat.
> 
> Thanks in advance and kind regards,
>    Simon
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org