You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Xybrek <xy...@gmail.com> on 2011/12/08 09:06:54 UTC

How to forward all kind of request from ROOT to another subdirectory?

Hello,

I need to forward all kind of request from the ROOT, i.e 
http://localhost:8080/ to http://localhost:8080/myRoot

Is it possible, do I need to create a redirect servlet? However, I think 
tomcat can be configured to behave that way?


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


Re: How to forward all kind of request from ROOT to another subdirectory?

Posted by Xybrek <xy...@gmail.com>.
On Friday, 09 December, 2011 01:18 AM, André Warnier wrote:
> Xybrek wrote:
>> On Thursday, 08 December, 2011 09:37 PM, André Warnier wrote:
>>> Xybrek wrote:
>>>> On 12/8/2011 9:19 PM, Xybrek wrote:
>>>>> On 12/8/2011 8:52 PM, Thom Hehl wrote:
>>>>>> Simplest would be to set up an index.html in the root path that
>>>>>> redirects to whatever you wish. You can find 500 hits on google about
>>>>>> how to do an HTML redirect.
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Xybrek [mailto:xybrek@gmail.com]
>>>>>> Sent: Thursday, December 08, 2011 3:07 AM
>>>>>> To: users@tomcat.apache.org
>>>>>> Subject: How to forward all kind of request from ROOT to another
>>>>>> subdirectory?
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I need to forward all kind of request from the ROOT, i.e
>>>>>> http://localhost:8080/ to http://localhost:8080/myRoot
>>>>>>
>>>>>> Is it possible, do I need to create a redirect servlet? However, I
>>>>>> think
>>>>>>
>>>>>> tomcat can be configured to behave that way?
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>>> Hi, I am using UrlRedirectFilter.
>>>>
>>>> Also, I am able to redirect with UrlRedirectFilter from
>>>> http://localhost:8080 to http://localhost:8080/myRoot
>>>>
>>>> However my problem now is that I want to keep the URL in the browser
>>>> relative to the original ROOT, i.e. right now when I request for
>>>> http://localhost:8080/index.html it will show
>>>> http://localhost:8080/myRoot/index.html
>>>>
>>>> but I want to keep it like http://localhost:8080/index.html and for
>>>> all other request.
>>>>
>>>> Maybe I need to do something with the rules in the urlrewrite.xml
>>>>
>>>> Any ideas?
>>>>
>>> Why do you not just rename "myRoot" to "ROOT", making this the default
>>> application ?
>>> http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F
>>>
>>>
>>
>>
>> Hi Andre,
>>
>> Thanks. I know about placing the web app (like myRoot) under the ROOT
>> and it will work. However, there is another issue I that comes when I
>> do this, an issue with my GWT (http://code.google.com/webtoolkit/) web
>> app, where the the client-side code cannot access the services
>> (servlets).
>>
>> My gwt application works just fine in the myRoot folder of the tomcat
>> webapps folder. So my idea, is just forward every access to the ROOT
>> to myRoot.
>>
>> But then again, if there's a better solution I am may want to try it.
>>
> I don't think that I really understand the problem.
> Let me re-phrase it, and you tell us if that is what you want :
>
> I want that when a browser accesses the URLs :
> "http://myhost:8080" or "http://myhost:8080/"
> (and only for those 2 specific URLs),
> it is redirected to "http://myhost:8080/myapp/".
>
> And I want that for all URLs which start with :
> http://myhost:8080/myapp
> they stay where they are (in "/myapp")
>
> And I want that if they ask for
> http://myhost:8080/something-else
> they really get "/something-else" from within the
> webapps/ROOT/something-else directory.
>
> Is that what you want ?

Hi Andre,

For "/somethingelse" yah that's what I mean. Every access to 
"http://myhost:8080" will be "forwarded" to http://myhost:8080/myapp

Like if request is: http://myhost:8080/something.html, it will forward 
it to http://myhost:8080/myapp/something.html

Or request like: http://myhost:8080/?q=test will be forwarded to 
http://myhost:8080/myapp/?q=test

Is it possible?


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


Re: How to forward all kind of request from ROOT to another subdirectory?

Posted by André Warnier <aw...@ice-sa.com>.
Xybrek wrote:
> On Thursday, 08 December, 2011 09:37 PM, André Warnier wrote:
>> Xybrek wrote:
>>> On 12/8/2011 9:19 PM, Xybrek wrote:
>>>> On 12/8/2011 8:52 PM, Thom Hehl wrote:
>>>>> Simplest would be to set up an index.html in the root path that
>>>>> redirects to whatever you wish. You can find 500 hits on google about
>>>>> how to do an HTML redirect.
>>>>>
>>>>> -----Original Message-----
>>>>> From: Xybrek [mailto:xybrek@gmail.com]
>>>>> Sent: Thursday, December 08, 2011 3:07 AM
>>>>> To: users@tomcat.apache.org
>>>>> Subject: How to forward all kind of request from ROOT to another
>>>>> subdirectory?
>>>>>
>>>>> Hello,
>>>>>
>>>>> I need to forward all kind of request from the ROOT, i.e
>>>>> http://localhost:8080/ to http://localhost:8080/myRoot
>>>>>
>>>>> Is it possible, do I need to create a redirect servlet? However, I
>>>>> think
>>>>>
>>>>> tomcat can be configured to behave that way?
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>> Hi, I am using UrlRedirectFilter.
>>>
>>> Also, I am able to redirect with UrlRedirectFilter from
>>> http://localhost:8080 to http://localhost:8080/myRoot
>>>
>>> However my problem now is that I want to keep the URL in the browser
>>> relative to the original ROOT, i.e. right now when I request for
>>> http://localhost:8080/index.html it will show
>>> http://localhost:8080/myRoot/index.html
>>>
>>> but I want to keep it like http://localhost:8080/index.html and for
>>> all other request.
>>>
>>> Maybe I need to do something with the rules in the urlrewrite.xml
>>>
>>> Any ideas?
>>>
>> Why do you not just rename "myRoot" to "ROOT", making this the default
>> application ?
>> http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F 
>>
>>
> 
> 
> Hi Andre,
> 
> Thanks. I know about placing the web app (like myRoot) under the ROOT 
> and it will work. However, there is another issue I that comes when I do 
> this, an issue with my GWT (http://code.google.com/webtoolkit/) web app, 
> where the the client-side code cannot access the services (servlets).
> 
> My gwt application works just fine in the myRoot folder of the tomcat 
> webapps folder. So my idea, is just forward every access to the ROOT to 
> myRoot.
> 
> But then again, if there's a better solution I am may want to try it.
> 
I don't think that I really understand the problem.
Let me re-phrase it, and you tell us if that is what you want :

I want that when a browser accesses the URLs :
"http://myhost:8080" or "http://myhost:8080/"
(and only for those 2 specific URLs),
it is redirected to "http://myhost:8080/myapp/".

And I want that for all URLs which start with :
http://myhost:8080/myapp
they stay where they are (in "/myapp")

And I want that if they ask for
http://myhost:8080/something-else
they really get "/something-else" from within the webapps/ROOT/something-else directory.

Is that what you want ?





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


Re: How to forward all kind of request from ROOT to another subdirectory?

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

Xybrek,

On 12/8/11 11:58 AM, Xybrek wrote:
> Thanks. I know about placing the web app (like myRoot) under the
> ROOT and it will work. However, there is another issue I that comes
> when I do this, an issue with my GWT
> (http://code.google.com/webtoolkit/) web app, where the the
> client-side code cannot access the services (servlets).

That sounds like a problem either with GWT (unlikely) or with your
webapp. Have you perchance been hard-coding your context paths?

Maybe we can help you fix your webapp so that you can re-home it
without these ugly hacks like semi-conditional redirection.

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

iEYEARECAAYFAk7hBiUACgkQ9CaO5/Lv0PDilgCdHIy/DWrAirNLKDw6L2zZZL8/
C+EAnAvxN1Y7ePPn0EVLfOXe+vQjZGQi
=letZ
-----END PGP SIGNATURE-----

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


Re: How to forward all kind of request from ROOT to another subdirectory?

Posted by Xybrek <xy...@gmail.com>.
On Thursday, 08 December, 2011 09:37 PM, André Warnier wrote:
> Xybrek wrote:
>> On 12/8/2011 9:19 PM, Xybrek wrote:
>>> On 12/8/2011 8:52 PM, Thom Hehl wrote:
>>>> Simplest would be to set up an index.html in the root path that
>>>> redirects to whatever you wish. You can find 500 hits on google about
>>>> how to do an HTML redirect.
>>>>
>>>> -----Original Message-----
>>>> From: Xybrek [mailto:xybrek@gmail.com]
>>>> Sent: Thursday, December 08, 2011 3:07 AM
>>>> To: users@tomcat.apache.org
>>>> Subject: How to forward all kind of request from ROOT to another
>>>> subdirectory?
>>>>
>>>> Hello,
>>>>
>>>> I need to forward all kind of request from the ROOT, i.e
>>>> http://localhost:8080/ to http://localhost:8080/myRoot
>>>>
>>>> Is it possible, do I need to create a redirect servlet? However, I
>>>> think
>>>>
>>>> tomcat can be configured to behave that way?
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>> Hi, I am using UrlRedirectFilter.
>>
>> Also, I am able to redirect with UrlRedirectFilter from
>> http://localhost:8080 to http://localhost:8080/myRoot
>>
>> However my problem now is that I want to keep the URL in the browser
>> relative to the original ROOT, i.e. right now when I request for
>> http://localhost:8080/index.html it will show
>> http://localhost:8080/myRoot/index.html
>>
>> but I want to keep it like http://localhost:8080/index.html and for
>> all other request.
>>
>> Maybe I need to do something with the rules in the urlrewrite.xml
>>
>> Any ideas?
>>
> Why do you not just rename "myRoot" to "ROOT", making this the default
> application ?
> http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F
>


Hi Andre,

Thanks. I know about placing the web app (like myRoot) under the ROOT 
and it will work. However, there is another issue I that comes when I do 
this, an issue with my GWT (http://code.google.com/webtoolkit/) web app, 
where the the client-side code cannot access the services (servlets).

My gwt application works just fine in the myRoot folder of the tomcat 
webapps folder. So my idea, is just forward every access to the ROOT to 
myRoot.

But then again, if there's a better solution I am may want to try it.




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


Re: How to forward all kind of request from ROOT to another subdirectory?

Posted by André Warnier <aw...@ice-sa.com>.
Xybrek wrote:
> On 12/8/2011 9:19 PM, Xybrek wrote:
>> On 12/8/2011 8:52 PM, Thom Hehl wrote:
>>> Simplest would be to set up an index.html in the root path that
>>> redirects to whatever you wish. You can find 500 hits on google about
>>> how to do an HTML redirect.
>>>
>>> -----Original Message-----
>>> From: Xybrek [mailto:xybrek@gmail.com]
>>> Sent: Thursday, December 08, 2011 3:07 AM
>>> To: users@tomcat.apache.org
>>> Subject: How to forward all kind of request from ROOT to another
>>> subdirectory?
>>>
>>> Hello,
>>>
>>> I need to forward all kind of request from the ROOT, i.e
>>> http://localhost:8080/ to http://localhost:8080/myRoot
>>>
>>> Is it possible, do I need to create a redirect servlet? However, I think
>>>
>>> tomcat can be configured to behave that way?
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>> Hi, I am using UrlRedirectFilter.
> 
> Also, I am able to redirect with UrlRedirectFilter from 
> http://localhost:8080 to http://localhost:8080/myRoot
> 
> However my problem now is that I want to keep the URL in the browser 
> relative to the original ROOT, i.e. right now when I request for 
> http://localhost:8080/index.html it will show 
> http://localhost:8080/myRoot/index.html
> 
> but I want to keep it like http://localhost:8080/index.html and for all 
> other request.
> 
> Maybe I need to do something with the rules in the urlrewrite.xml
> 
> Any ideas?
> 
Why do you not just rename "myRoot" to "ROOT", making this the default application ?
http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F

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


Re: How to forward all kind of request from ROOT to another subdirectory?

Posted by Xybrek <xy...@gmail.com>.
On 12/8/2011 9:19 PM, Xybrek wrote:
> On 12/8/2011 8:52 PM, Thom Hehl wrote:
>> Simplest would be to set up an index.html in the root path that
>> redirects to whatever you wish. You can find 500 hits on google about
>> how to do an HTML redirect.
>>
>> -----Original Message-----
>> From: Xybrek [mailto:xybrek@gmail.com]
>> Sent: Thursday, December 08, 2011 3:07 AM
>> To: users@tomcat.apache.org
>> Subject: How to forward all kind of request from ROOT to another
>> subdirectory?
>>
>> Hello,
>>
>> I need to forward all kind of request from the ROOT, i.e
>> http://localhost:8080/ to http://localhost:8080/myRoot
>>
>> Is it possible, do I need to create a redirect servlet? However, I think
>>
>> tomcat can be configured to behave that way?
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>
> Hi, I am using UrlRedirectFilter.

Also, I am able to redirect with UrlRedirectFilter from 
http://localhost:8080 to http://localhost:8080/myRoot

However my problem now is that I want to keep the URL in the browser 
relative to the original ROOT, i.e. right now when I request for 
http://localhost:8080/index.html it will show 
http://localhost:8080/myRoot/index.html

but I want to keep it like http://localhost:8080/index.html and for all 
other request.

Maybe I need to do something with the rules in the urlrewrite.xml

Any ideas?




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


Re: How to forward all kind of request from ROOT to another subdirectory?

Posted by Xybrek <xy...@gmail.com>.
On 12/8/2011 8:52 PM, Thom Hehl wrote:
> Simplest would be to set up an index.html in the root path that
> redirects to whatever you wish. You can find 500 hits on google about
> how to do an HTML redirect.
>
> -----Original Message-----
> From: Xybrek [mailto:xybrek@gmail.com]
> Sent: Thursday, December 08, 2011 3:07 AM
> To: users@tomcat.apache.org
> Subject: How to forward all kind of request from ROOT to another
> subdirectory?
>
> Hello,
>
> I need to forward all kind of request from the ROOT, i.e
> http://localhost:8080/ to http://localhost:8080/myRoot
>
> Is it possible, do I need to create a redirect servlet? However, I think
>
> tomcat can be configured to behave that way?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org

Hi, I am using UrlRedirectFilter.


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


RE: How to forward all kind of request from ROOT to another subdirectory?

Posted by Thom Hehl <Th...@pointsix.com>.
Simplest would be to set up an index.html in the root path that
redirects to whatever you wish. You can find 500 hits on google about
how to do an HTML redirect.

-----Original Message-----
From: Xybrek [mailto:xybrek@gmail.com] 
Sent: Thursday, December 08, 2011 3:07 AM
To: users@tomcat.apache.org
Subject: How to forward all kind of request from ROOT to another
subdirectory?

Hello,

I need to forward all kind of request from the ROOT, i.e 
http://localhost:8080/ to http://localhost:8080/myRoot

Is it possible, do I need to create a redirect servlet? However, I think

tomcat can be configured to behave that way?


---------------------------------------------------------------------
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