You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by tom_goring <to...@gmail.com> on 2008/07/01 09:40:13 UTC

Re: multiple instances and context roots

Thanks for the info Guys.

I'm already using proxy forwarding but it is not really acceptable for
production env's (e.g. you loose the clients IP, error handling is not as
good, etc).  

I'm after a simple setting that appends a prefix on the URI so a WAR dropped
in webapp's dir is prefixed with dev/test/etc.  Does not look like there is
one though.

Again my setup is:

https://www.myserver.com/test/WebApp/test.jsp maps to using mod_jk
http://www.myserver.com:8181/test/WebApp/test.jsp 

https://www.myserver.com/dev/WebApp/test.jsp maps to using mod_jk
http://www.myserver.com:8182/dev/WebApp/test.jsp

Any other ideas?

Thanks in advance.




Johnny Kewl wrote:
> 
> 
> ----- Original Message ----- 
> From: "Johnny Kewl" <jo...@kewlstuff.co.za>
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Sent: Thursday, June 26, 2008 3:15 PM
> Subject: Re: multiple instances and context roots
> 
> 
>>
>> ----- Original Message ----- 
>> From: "tom_goring" <to...@gmail.com>
>> To: <us...@tomcat.apache.org>
>> Sent: Thursday, June 26, 2008 12:09 PM
>> Subject: multiple instances and context roots
>>
>>
>>>
>>> Hi,
>>>
>>> I've posted this on the jboss forum but had no response... it's really a
>>> tomcat question.
>>>
>>> jboss-4.2.2 (not sure of the tomcat version used)
>>>
>>> I have several jboss installs running behind apache using mod_jk (dev, 
>>> test,
>>> production, etc)
>>>
>>> I can't use virtual hosts as all my instances require SSL and this is 
>>> only
>>> set up for 1 domain. Each instance runs on it's own ports.
>>>
>>> I want a simple way to tell each jboss/tomcat instance to use a
>>> reliative
>>> context.
>>>
>>> E.g.
>>>
>>> https://www.myserver.com/dev/MYAPP/hello.jsp
>>> https://www.myserver.com/test/MYAPP/hello.jsp
>>>
>>> I.e. I want to know where I can set dev/test, etc.
>>>
>>> I don't really want to change the application.xml (context-root) for
>>> each
>>> EAR file when installed (as that would require rebuilding the EAR 
>>> dependent
>>> on the instance).
>>>
>>> Ideas ?
>>
>> Tom, I have no knowledge of Jboss... we dont use EJB at all, so I'm just 
>> going to tell you what TC does to get sub contexts, and then you on your 
>> own.
>>
>> Say you want /dev/MyApp
>> The context file name in conf/host  becomes
>>
>> dev#MyApp.xml
>>
>> The path in the context file becomes
>>
>> path="/dev/MyApp"/>
>>
>> And in webapps folder it becomes
>>
>> /dev/The UnPacked Webapp
>>
>> Deployment is not possible by dropping a war into tomcat... the war must 
>> not be there, else TC will auto deploy and mess up your config.
>>
>> Then I "guess" JkMount /dev/*  theWorker.....  may work...
>>
>> And hopefully nothing in those apps is hardcoded... like URI's in jsp 
>> pages etc.
>> And EJB is still happy...
>>
>> Some really creative guy Alex Mestiashvili showed us a way (unrelated) to 
>> map different IP's to different webapps a while back using a reverse
>> proxy 
>> and some other incredible rewrite stuff that Apache can do... JK works on 
>> relative uri's, but I think its worth a bash asking the Apached guys if 
>> one cant map
>>
>> https://www.myserver.com/dev/MYAPP/hello.jsp
>> https://www.myserver.com/test/MYAPP/hello.jsp
>>
>> to
>>
>> https://www.myserver.com:8080/MYAPP/hello.jsp
>> https://www.myserver.com:8081/MYAPP/hello.jsp
>>
>> etc...
>>
>> Or something even more creative... ie try get apache to present TC/JBoss 
>> with something it likes...
>> Maybe mod proxy has a few tricks that jk does not... worth getting into 
>> the Httpd mailing list and asking, I think.
>> JK is terrific at load balancing, but you just trying to use it as a kind 
>> of gateway... Apached is probably good at that.
>>
>> Good luck.... sorry cant be more helpful
>>
>> ---------------------------------------------------------------------------
>> HARBOR : http://www.kewlstuff.co.za/index.htm
>> The most powerful application server on earth.
>> The only real POJO Application Server.
>> See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
>> ---------------------------------------------------------------------------
> 
> After Thought...
> Been thinking about the idea of mapping....
> 
>  https://www.myserver.com/dev/MYAPP/hello.jsp
>  https://www.myserver.com/prod/MYAPP/hello.jsp
> 
>  to
> 
>  https://www.myserver.com:8080/MYAPP/hello.jsp
> https://www.myserver.com:8081/MYAPP/hello.jsp
> 
> asked the Apache guys... maybe there is a guru out there with an alt plan, 
> but I think it needs planning when making the WebApp
> This will map incoming requests....
> 
> ProxyRequests Off
> 
> <Proxy *>
> Order deny,allow
> Allow from all
> </Proxy>
> 
> ProxyPass /dev http://localhost:8080
> ProxyPassReverse /dev http://localhost:8080
> 
> ProxyPass /prod http://localhost:8081
> ProxyPassReverse /prod http://localhost:8081
> 
> but the problem is that the actual links on your pages are going to still
> be
> 
> http://www.myserver.com/MYAPP/hello.jsp
> 
> so... one would have to plan for it and have say a context parameter that 
> one could also set... so that it adjusts
> page urls to /dev/MYAPP
> 
> The above mod proxy stuff... does this.... maps
> 
> domain/dev/MyApp
> to
> localhost:8080/MyApp
> 
> so the incoming is adjusted... which leaves getting your own links
> right... 
> so maybe TC sub contexts and JK is the way to go...
> 
> Anyway, I dont think even the great Apache can fix this one, without a 
> little fore planning.
> ... I think ;)
> 
> ------------------
> ... now that .com .org. net is opening up?
> tomcat.apache.org
> could become
> tomcat.apache.ThenMicrosoft ;)
> 
> or what about...
> 
> tomcat.apache.sun
> 
> ha ha
> 
> Its going to be chaos ;)
> -----------------
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/multiple-instances-and-context-roots-tp18130544p18210932.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: multiple instances and context roots

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tom,

tom_goring wrote:
| I'm after a simple setting that appends a prefix on the URI so a WAR
dropped
| in webapp's dir is prefixed with dev/test/etc.  Does not look like
there is
| one though.

mod_rewrite is a magical beast. Read the httpd documentation for this
module and you should be able to come up with a pattern that maps one
URL to another before handing the request off to mod_jk. Just remember
that you need to set the "continue process" bit in the options for the
RewriteRule.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhquYMACgkQ9CaO5/Lv0PAjdgCffiWv+mSYfwTBeH1qqVOMtK1E
rwkAn2pvOriIm74KV/xOFbHqgamz0Sku
=u+TL
-----END PGP SIGNATURE-----

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