You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jigi Sheth <js...@src-solutions.com> on 2013/03/25 17:39:09 UTC

Change Root app Tomcat 7

My current set up in Tomcat 7 is when I drop my Application.war to `\Tomcat7\webapps\` directory, it gets auto deployed  `\Tomcat7\webapps\root\` directory.

To access my site in testing I use following

    http:\\mytestserver.mysitename\Login.html

During testing I also noticed that if i do

    http:\\mysitename\

it gets me to my default page [default.html]


I am trying to change the way this is currently set up to following

The auto deploy of `Application.war` can still occur to `\Tomcat7\webapps\root\` directory.

To access site, I would like to use following URL

    http:\\mytestserver.mysitename\Application.war\Login.html

and anyone using the previously bookmarked address

     http:\\mytestserver.mysitename\Login.html

get redirected to

    http:\\mytestserver.mysitename\Application.war\Login.html


I have the following redirect in my `apache/conf/httpd.conf`

    JkMount /*.html ajp13

and my worker.properties file has following host info

    worker.ajp13.host=http:\\mytestserver.mysitename


Reference used:
[How to set up sites in Tomcat7][1]
[How_do_I_make_my_web_application_be_the_Tomcat_default_application][2]



  [1]: http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application_.3F
  [2]: http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F

Re: Change Root app Tomcat 7

Posted by Mark Eggers <it...@yahoo.com>.
On 3/26/2013 1:05 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Mark,
>
> On 3/25/13 2:21 PM, Mark Eggers wrote:
>> Finally, since you're using Apache HTTPD in front of your Apache
>> Tomcat, you could use a Redirect directive in httpd.conf to
>> accomplish your goal.
>
> +1
>
>> Something like the following might work:
>>
>> RedirectMatch permanent /(.*)
>> http://mytestserver.mysitename/Application/$1
>
> That's gonna set up a redirect loop :(

Yep, you're right. Serves me right for copy-pastea from my HTTP to HTTPS 
redirect.

>
> I think what you're going to want is closer to this:
>
> RedirectMatch permanent /Login.html http://..../login.html
> RedirectMatch permanent / http://..../login.html
>
> That way, when people go to either / or /login.html, then will be
> redirected.
>
> You can add all sorts of additional redirects if you choose to.
>
> - -chris

. . . . just my two cents (apparently over and over and over and )
/mde/

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


Re: Change Root app Tomcat 7

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

Mark,

On 3/25/13 2:21 PM, Mark Eggers wrote:
> Finally, since you're using Apache HTTPD in front of your Apache
> Tomcat, you could use a Redirect directive in httpd.conf to
> accomplish your goal.

+1

> Something like the following might work:
> 
> RedirectMatch permanent /(.*)
> http://mytestserver.mysitename/Application/$1

That's gonna set up a redirect loop :(

I think what you're going to want is closer to this:

RedirectMatch permanent /Login.html http://..../login.html
RedirectMatch permanent / http://..../login.html

That way, when people go to either / or /login.html, then will be
redirected.

You can add all sorts of additional redirects if you choose to.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRUf91AAoJEBzwKT+lPKRYE3IQAJWvY1ig+LIs8/q9kJRjfioJ
pzIbTNmhW2SYOdsrBCuWNwstE+yO8O0dlR0zzWdp/KQncoa0F8AkD5CfLqgP68Yt
JLJC5Zvh7jmWzzdoAsbIjsh2lReWv+GwGrmZ9Kt8L+RGlGeV0e7a1HJSTncNz4p+
TCwJT5ag81dMH8qMXpmtzbPf2Lv+WXgjMOoy/UXAkI/aKpDDFjU0Gt9Zq9tVGRbb
S9Q9+UcQZ2VcmInqe52Mm3L1oyxkOSJyY0HyWyiSvKHTWktpWUOSZuMMNODKSDz9
YU8iRcIxTflbw63haYXPi2TjLc2vJuwl2wR9xLInSFG5zvCZGxeInw65Dglp6wvS
dJDN/okoXoGhJM9BKjDg7C+2bypHKcEZOegb+H1epMtsvm+Wpx8ILIYOgIjcEt3w
t1AK2EwbdvuNcvOHQkLyrLE0E7YvM3CUxuTIrQb0sEV2s24XtxP8rjEd3dV0VrkW
DAuAKLS5vWzf9+2pks4IYrAIgklZ9cZxig+gU4mvw02pHnAbJ+S7zIKN07qm5D1Q
545WgA2tEY2BuNFHlPvV1BZb7flqOeu6P/mBnO+Hd5KuivrSPwZzsmvrz2qRbCzR
l6W73yJ2hyl5ZVHcVNW7KQZklnI2/2WA5jmwNseQOaLqPDhr2RGuBsX8Sl//Zx49
84TI7oGGc6pHM/ywqqd0
=vrBF
-----END PGP SIGNATURE-----

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


Re: Change Root app Tomcat 7

Posted by Mark Eggers <it...@yahoo.com>.
OK, I'll bite.

Please note that a lot of this is using inferred information since you 
don't provide it in your mail message.

Responses inline

On 3/25/2013 9:39 AM, Jigi Sheth wrote:
> My current set up in Tomcat 7 is when I drop my Application.war to
> `\Tomcat7\webapps\` directory, it gets auto deployed
> `\Tomcat7\webapps\root\` directory.
>

===
Case is important - the directory must be ROOT, even on Windows.
===

> To access my site in testing I use following
>
> http:\\mytestserver.mysitename\Login.html
>
> During testing I also noticed that if i do
>
> http:\\mysitename\
>
> it gets me to my default page [default.html]
>

===
So you have a page called default.html and it's specified like this:

<welcome-file-list>
     <welcome-file>default.html</welcome-file>
</welcome-file-list>

in your web.xml
===

>
> I am trying to change the way this is currently set up to following
>
> The auto deploy of `Application.war` can still occur to
> `\Tomcat7\webapps\root\` directory.
>

===
No, the auto-deploy of the application (if you've named it 
Application.war) should create a \Tomcat7\webapps\Application directory 
- provided you've left the default server.xml unpackWARs="true" for your 
Host element alone.
====

> To access site, I would like to use following URL
>
> http:\\mytestserver.mysitename\Application.war\Login.html
>

===
Hopefully you mean:

http://mytestserver.mysite/Application/Login.html

Note the above:

1. Slashes are not Windows-based
2. Application - not Application.war

Naming a file called Application.war.war (to generate an Application.war 
URL) will cause double deployment. At least it did on my quick test . . .
===

> and anyone using the previously bookmarked address
>
> http:\\mytestserver.mysitename\Login.html
>
> get redirected to
>
> http:\\mytestserver.mysitename\Application.war\Login.html
>
>

===
And now we get to the heart of the problem . . . .
===

> I have the following redirect in my `apache/conf/httpd.conf`
>
> JkMount /*.html ajp13
>

===
Ah, so you have a front end Apache HTTPD server connected via AJP. This 
is nice to know.
===

> and my worker.properties file has following host info
>
> worker.ajp13.host=http:\\mytestserver.mysitename
>

===
And you're trying to use mod_jk . . .

The above two lines (the JkMount and the worker.ajp.host) are 
problematic at best.

The first will almost certainly not get you what you want, and the 
second appears to be a mix of mod_proxy_http and mod_ajp.  The second 
line will not work at all.

If you're using mod_jk, one clean set of JkMounts is:

JkMount /Application/ ajp13
JkMount /Application/* ajp13

I won't address your workers.properties file in this message. However, 
please read the following link:

http://tomcat.apache.org/connectors-doc/reference/workers.html

Also, download the source code for the connector, unpack it, and look in 
conf subdirectory. There are some very good examples on how to set up 
workers.properties, uriworkermap.properties, and httpd.conf (httpd-jk.conf).

Finally, since you're using Apache HTTPD in front of your Apache Tomcat, 
you could use a Redirect directive in httpd.conf to accomplish your goal.

Something like the following might work:

RedirectMatch permanent /(.*) http://mytestserver.mysitename/Application/$1

Please note that the above line may be wrapped (it should be on one line).

===

>
> Reference used: [How to set up sites in Tomcat7][1]
> [How_do_I_make_my_web_application_be_the_Tomcat_default_application][2]
>
>
>
>
> [1]:http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application_.3F
>
>
 > [2]:http://wiki.apache.org/tomcat>
 > /HowTo#
 > How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F
>

. . . . just my two cents.
/mde/

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