You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Madison Le <ml...@txwes.edu> on 2013/12/09 15:30:22 UTC

Redirect or Forward a URL on tomcat

Hello Everyone,

I have tried to redirect or forward a URL on tomcat but I am not sure how to do this.

The tomcat console is http://ramlink.txwes.edu:8080 or https://ramlink.txwes.edu:8443. I created a web application which has the URL is https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor. I would like to redirect the https://ramlink.txwes.edu to https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor.

In addition, the tomcat version is 7.0 on windows 2008 R2.

Any help would greatly appreciate.

Madison

Re: Redirect or Forward a URL on tomcat

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

André,

On 12/9/13, 4:26 PM, André Warnier wrote:
> Madison Le wrote:
> 
> On this list, please do not top-post. See :
> http://tomcat.apache.org/lists.html#tomcat-users Important - #6
> 
>> Hello Andre',
>> 
>> Yes, this looks strange but this webapp 
>> (https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor) needs to
>> have 2 levels down. It can have a different name at this levels
>> (like WebAdvisor/Production), but it needs to have this format
>> for it to work. Do You mean that make the 
>> https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor to be the 
>> "default webapp" or https://ramlink.txwes.edu to the "default
>> webapp" ? Do you know the article which talks about this? I could
>> not find it.
> See : http://wiki.apache.org/tomcat/HowTo #17
> 
> I meant to make it so that both "http://ramlink.txwes.edu:8080/"
> and "http://ramlink.txwes.edu:8443/" lead directly to your webapp,
> but if you confirm that it somehow "must be" configured as
> "/WebAdvisor/x" then you may be out of luck with the standard and
> easy method.
> 
> You might need to create a ROOT context which "forwards" the calls
> to "/", to "/WebAdvisor/".  For that kind of thing, you may want to
> look at the URLRewrite filter, at http://www.tuckey.org if I
> remember right.

If all you want to do is redirect the specific URL
http://ramlink.txwes.edu:8080/ ->
http://ramlink.txwes.edu:8080/WebAdvisor/WebAdvisor, then you probably
don't need the "complexity" of url-rewrite: just code-up a catch-all
servlet and have it execute a redirect.

If you want to be able to redirect
http://ramlink.txwes.edu:8080/foo/bar/baz ->
http://ramlink.txwes.edu:8080/WebAdvisor/WebAdvisor/foo/bar/baz, then
use url-rewrite, as it can do regular expression matching,
replacement, etc.

> Note that it is quite bad practice for an application to force one
> to install it under any particular "context name".  It probably
> means that the application itself generates/contains
> self-referencing absolute URLs in the pages which it returns, which
> will probably create some additional headaches for you in terms of
> getting it to work correctly under the root ("/") context.

+1

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

iQIcBAEBCAAGBQJSpj0mAAoJEBzwKT+lPKRYDxIQALEHVxMBkfOOFAxQ4S2UJNMe
HK7TzZsFeqKFQCcwb0Qw9AASnBf4wW5jHiMdLO3k4Wf5oXsxhQleCNlBRqF2lj3l
KDemznJ2WOgh7QZX0k7usqGRlK2q4/spTU6SVs3OvoAFs0W5mL/qyK0KhDD+E3/k
gOqVIPNzbpyhhCtdJewYG8o20+TySdl9QkQdMDs7ThpLkll8WQ9LAhSUwnwPs6db
tIRsDqQARJ6KsTfYRm579MDKXFYfJSnrn5Y96636BQdKTkpd48K6mVeTyVq9Dbz9
XrLXCJ3Z7dDdyZ9H02nuzwLD7YUQdmh4/ZHCH5HEyQ5FGMWPZkbqZOFfiEcSwgVa
e5L/qOZbxAPa6zZRiCCU4i93XT8fD0NcezQ7rDdYXrGWdIrCBmp9aGRiuX07yBoS
11qo+lelauDtAW52Ei73LgWtimPAypoPFP4ABZWyr8Dsz9lDz09coXGOdOQz1emv
ZjmKrBbvRioO3dLwqiWY+0SDccjBh3rw5Zy38I0dK73coT/6eUDlvN6yytXGPktf
Qu8AzKbSjEfyzkSyGEx2p593brJz4t65wCIJYHI8DuG62jmUL2goC08AJKTcxbB3
WpvRnO2jWeYWiwgF/160jQF9TzLLsJLdFIZelyYkgdkZaBAXAwa98iFFzmb+EHp8
J9EbFz5imZCv/aErbufA
=Wz3g
-----END PGP SIGNATURE-----

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


Re: Redirect or Forward a URL on tomcat

Posted by André Warnier <aw...@ice-sa.com>.
Madison Le wrote:

On this list, please do not top-post.
See : http://tomcat.apache.org/lists.html#tomcat-users
Important - #6

> Hello Andre',
> 
> Yes, this looks strange but this webapp (https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor) needs to have 2 levels down. It can have a different name at this levels (like WebAdvisor/Production), but it needs to have this format for it to work. 
> 
> Do You mean that make the https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor to be the "default webapp" or https://ramlink.txwes.edu to the "default webapp" ? Do you know the article which talks about this? I could not find it. 
> 
See :
http://wiki.apache.org/tomcat/HowTo
#17

I meant to make it so that both "http://ramlink.txwes.edu:8080/" and 
"http://ramlink.txwes.edu:8443/" lead directly to your webapp, but if you confirm that it 
somehow "must be" configured as "/WebAdvisor/x" then you may be out of luck with the 
standard and easy method.

You might need to create a ROOT context which "forwards" the calls to "/", to 
"/WebAdvisor/".  For that kind of thing, you may want to look at the URLRewrite filter, at 
http://www.tuckey.org if I remember right.

Note that it is quite bad practice for an application to force one to install it under any 
particular "context name".  It probably means that the application itself 
generates/contains self-referencing absolute URLs in the pages which it returns, which 
will probably create some additional headaches for you in terms of getting it to work 
correctly under the root ("/") context.
You should really contact the developers of that application, for this question.


> Thanks
> 
> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com] 
> Sent: Monday, December 09, 2013 8:40 AM
> To: Tomcat Users List
> Subject: Re: Redirect or Forward a URL on tomcat
> 
> Madison Le wrote:
>> Hello Everyone,
>>
>> I have tried to redirect or forward a URL on tomcat but I am not sure how to do this.
>>
>> The tomcat console is http://ramlink.txwes.edu:8080 or https://ramlink.txwes.edu:8443. I created a web application which has the URL is https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor. I would like to redirect the https://ramlink.txwes.edu to https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor.
>>
>> In addition, the tomcat version is 7.0 on windows 2008 R2.
>>
>> Any help would greatly appreciate.
>>
> 
> What you probably want, is to have this webapp become the "default webapp", so that it responds itself to the URL http://ramlink.txwes.edu:8080/.
> For that, you need to change it into the ROOT webapp.
> I'm quite sure that there is a Tomcat FAQ article for that.
> 
> Note that I am bit surprised that currently your app responds to "/WebAdvisor/WebAdvisor" 
> (instead of just "/WebAdvisor"). That looks like a misconfiguration already somehow.
> 
> ---------------------------------------------------------------------
> 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
> 
> 


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


RE: Redirect or Forward a URL on tomcat

Posted by Madison Le <ml...@txwes.edu>.
Hello Andre',

Yes, this looks strange but this webapp (https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor) needs to have 2 levels down. It can have a different name at this levels (like WebAdvisor/Production), but it needs to have this format for it to work. 

Do You mean that make the https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor to be the "default webapp" or https://ramlink.txwes.edu to the "default webapp" ? Do you know the article which talks about this? I could not find it. 

Thanks

-----Original Message-----
From: André Warnier [mailto:aw@ice-sa.com] 
Sent: Monday, December 09, 2013 8:40 AM
To: Tomcat Users List
Subject: Re: Redirect or Forward a URL on tomcat

Madison Le wrote:
> Hello Everyone,
> 
> I have tried to redirect or forward a URL on tomcat but I am not sure how to do this.
> 
> The tomcat console is http://ramlink.txwes.edu:8080 or https://ramlink.txwes.edu:8443. I created a web application which has the URL is https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor. I would like to redirect the https://ramlink.txwes.edu to https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor.
> 
> In addition, the tomcat version is 7.0 on windows 2008 R2.
> 
> Any help would greatly appreciate.
> 

What you probably want, is to have this webapp become the "default webapp", so that it responds itself to the URL http://ramlink.txwes.edu:8080/.
For that, you need to change it into the ROOT webapp.
I'm quite sure that there is a Tomcat FAQ article for that.

Note that I am bit surprised that currently your app responds to "/WebAdvisor/WebAdvisor" 
(instead of just "/WebAdvisor"). That looks like a misconfiguration already somehow.

---------------------------------------------------------------------
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: Redirect or Forward a URL on tomcat

Posted by André Warnier <aw...@ice-sa.com>.
Madison Le wrote:
> Hello Everyone,
> 
> I have tried to redirect or forward a URL on tomcat but I am not sure how to do this.
> 
> The tomcat console is http://ramlink.txwes.edu:8080 or https://ramlink.txwes.edu:8443. I created a web application which has the URL is https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor. I would like to redirect the https://ramlink.txwes.edu to https://ramlink.txwes.edu:8443/WebAdvisor/WebAdvisor.
> 
> In addition, the tomcat version is 7.0 on windows 2008 R2.
> 
> Any help would greatly appreciate.
> 

What you probably want, is to have this webapp become the "default webapp", so that it 
responds itself to the URL http://ramlink.txwes.edu:8080/.
For that, you need to change it into the ROOT webapp.
I'm quite sure that there is a Tomcat FAQ article for that.

Note that I am bit surprised that currently your app responds to "/WebAdvisor/WebAdvisor" 
(instead of just "/WebAdvisor"). That looks like a misconfiguration already somehow.

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