You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kernel freak <ke...@gmail.com> on 2015/12/03 16:54:16 UTC

URL based redirection working partially with Apache tomcat

Hello friends,

I would like to deploy multiple webapps(as of now 2,waiting for domain name
for 3rd) on a single Apache Tomcat instance. I have been partially
successful as one URL is working properly, other is not.

Situation :
1) I have created two folders called domain1_webapps  and domain2_webapps
and put the respective webapps named ROOT.war in each of them.
2) Then I configured server.xml as mentioned below.


 <Host name="localhost"  appBase="webapps" unpackWARs="true"
autoDeploy="true"/>
        <Host name="www.domain-one.com" autoDeploy="true" unpackWARs="true"
appBase="domain1_webapps"/>
        <Host name="www.domain-two.com" autoDeploy="true" unpackWARs="true"
appBase="domain2_webapps"/>

Right now when I call www.domain-one.com( not domain-one.com), I get the
correct site. But for the 2nd one, I have to call
www.domain-two.com/app_name.

*How can I remove in 2nd domain the app_name context-path which is getting
appended. Kindly let me know. *

The ironical situation is I have not kept the app_name anywhere, guess
Tomcat must be retrieving it from POM.xml.

Reference question on SO :
http://stackoverflow.com/questions/34069289/apache-tomcat-url-based-redirection-partially-works

Regards,
Kernel

Re: URL based redirection working partially with Apache tomcat

Posted by Kernel freak <ke...@gmail.com>.
Hi Chris,

I was able to finally resolve it by adding Host elements directly in
server.xml and creating separate webapps folder for each app to hold the
WAR file. I am on to a bigger fish. I will post a question soon in mailing
list. Thank you.

On Thu, Dec 3, 2015 at 6:37 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> To whom it may concern,
>
> On 12/3/15 10:54 AM, Kernel freak wrote:
> > Hello friends,
> >
> > I would like to deploy multiple webapps(as of now 2,waiting for domain
> name
> > for 3rd) on a single Apache Tomcat instance. I have been partially
> > successful as one URL is working properly, other is not.
> >
> > Situation :
> > 1) I have created two folders called domain1_webapps  and domain2_webapps
> > and put the respective webapps named ROOT.war in each of them.
> > 2) Then I configured server.xml as mentioned below.
> >
> >
> >  <Host name="localhost"  appBase="webapps" unpackWARs="true"
> > autoDeploy="true"/>
> >         <Host name="www.domain-one.com" autoDeploy="true"
> unpackWARs="true"
> > appBase="domain1_webapps"/>
> >         <Host name="www.domain-two.com" autoDeploy="true"
> unpackWARs="true"
> > appBase="domain2_webapps"/>
> >
> > Right now when I call www.domain-one.com( not domain-one.com), I get the
> > correct site. But for the 2nd one, I have to call
> > www.domain-two.com/app_name.
> >
> > *How can I remove in 2nd domain the app_name context-path which is
> getting
> > appended. Kindly let me know. *
> >
> > The ironical situation is I have not kept the app_name anywhere, guess
> > Tomcat must be retrieving it from POM.xml.
> >
> > Reference question on SO :
> >
> http://stackoverflow.com/questions/34069289/apache-tomcat-url-based-redirection-partially-works
>
> Have you read the documentation for how to deploy a web application in
> Tomcat?
>
>
> http://tomcat.apache.org/tomcat-8.0-doc/config/context.html#Defining_a_context
>
> -chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: URL based redirection working partially with Apache tomcat

Posted by Christopher Schultz <ch...@christopherschultz.net>.
To whom it may concern,

On 12/3/15 10:54 AM, Kernel freak wrote:
> Hello friends,
> 
> I would like to deploy multiple webapps(as of now 2,waiting for domain name
> for 3rd) on a single Apache Tomcat instance. I have been partially
> successful as one URL is working properly, other is not.
> 
> Situation :
> 1) I have created two folders called domain1_webapps  and domain2_webapps
> and put the respective webapps named ROOT.war in each of them.
> 2) Then I configured server.xml as mentioned below.
> 
> 
>  <Host name="localhost"  appBase="webapps" unpackWARs="true"
> autoDeploy="true"/>
>         <Host name="www.domain-one.com" autoDeploy="true" unpackWARs="true"
> appBase="domain1_webapps"/>
>         <Host name="www.domain-two.com" autoDeploy="true" unpackWARs="true"
> appBase="domain2_webapps"/>
> 
> Right now when I call www.domain-one.com( not domain-one.com), I get the
> correct site. But for the 2nd one, I have to call
> www.domain-two.com/app_name.
> 
> *How can I remove in 2nd domain the app_name context-path which is getting
> appended. Kindly let me know. *
> 
> The ironical situation is I have not kept the app_name anywhere, guess
> Tomcat must be retrieving it from POM.xml.
> 
> Reference question on SO :
> http://stackoverflow.com/questions/34069289/apache-tomcat-url-based-redirection-partially-works

Have you read the documentation for how to deploy a web application in
Tomcat?

http://tomcat.apache.org/tomcat-8.0-doc/config/context.html#Defining_a_context

-chris

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