You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Anand HS <an...@gmail.com> on 2009/03/03 12:23:15 UTC

A question about redirecton from users.mydomain.com to mydomain.com/users

Hi,
I have a requirement where I need to configure my Tomcat server to accept
any requests to users.mydomain.com and internally see what the value of
'users ' is and then serve the content from that user subdirectory on
www.mydomain.com.

For eg, if the URL is johndoe.mydomain.com my tomcat should internally map
this to www.mydomain.com/johndoe and render index.html in johndoe subfolder.


Is this type of configuration possible in tomcat. ? Or is this possible in
apache server . ?

Apologise for posing a question that might have answers in apache server.
But i put it here as i want to solve this using tomcat only if it can solve
the problem.

Thanks,
Anand

Re: A question about redirecton from users.mydomain.com to mydomain.com/users

Posted by Pid <p...@pidster.com>.
Tim Funk wrote:
> I have not used it before.
> 
> I can't imagine why it would not preserve POST requests.

OP's probably confusing redirect with forward.

Gotcha to look out for: you'll need to set the Host you're using to be
the default Host in the Engine, or *.domain.com requests will go to the
wrong location.

Either that or you'll constantly be adding Aliases.


p




> -Tim
> 
> Anand HS wrote:
>> Thanks Andre and Tim for the quick response.
>> I do not have an apache server right now. So URL Rewrite tool seems
>> like a
>> good solution.
>> However, I understand that the URL rewrite mechanism ends up losing any
>> parameters when a HTTP POST request is sent to my domain resource.
>> While I am right now downloading and will do a complete read up on
>> URLRewriter, could you give me quick heads up based on your experience of
>> this tool, if it handles HTTP Post request and does it preserve my
>> parameters. ?
> 
> 
> ---------------------------------------------------------------------
> 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: A question about redirecton from users.mydomain.com to mydomain.com/users

Posted by Tim Funk <fu...@joedog.org>.
I have not used it before.

I can't imagine why it would not preserve POST requests.

-Tim

Anand HS wrote:
> Thanks Andre and Tim for the quick response.
> I do not have an apache server right now. So URL Rewrite tool seems like a
> good solution.
> However, I understand that the URL rewrite mechanism ends up losing any
> parameters when a HTTP POST request is sent to my domain resource.
> While I am right now downloading and will do a complete read up on
> URLRewriter, could you give me quick heads up based on your experience of
> this tool, if it handles HTTP Post request and does it preserve my
> parameters. ?


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


Re: A question about redirecton from users.mydomain.com to mydomain.com/users

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

Anand,

On 3/3/2009 6:59 AM, Anand HS wrote:
> However, I understand that the URL rewrite mechanism ends up losing any
> parameters when a HTTP POST request is sent to my domain resource.

If you're issuing a /redirect/, you'll need to use the 307 response code
which means "please repeat your request on this other URL, and please
repeat it as a POST if the original request was a POST".

See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

> While I am right now downloading and will do a complete read up on
> URLRewriter, could you give me quick heads up based on your experience of
> this tool, if it handles HTTP Post request and does it preserve my
> parameters. ?

This is the client's job, not the server's job. If you want to /proxy/
requests (that is, have the server fetch the www.foo.com/username and
return the bytes to the client) then that's a different story.

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

iEYEARECAAYFAkmtYVwACgkQ9CaO5/Lv0PCtewCcCiDx0i6rPR+S2ivFR/E0E85D
bgAAoLZEhwBbf4HciEjKvEIFoG+H4thN
=fAsp
-----END PGP SIGNATURE-----

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


Re: A question about redirecton from users.mydomain.com to mydomain.com/users

Posted by Anand HS <an...@gmail.com>.
Thanks Andre and Tim for the quick response.
I do not have an apache server right now. So URL Rewrite tool seems like a
good solution.
However, I understand that the URL rewrite mechanism ends up losing any
parameters when a HTTP POST request is sent to my domain resource.
While I am right now downloading and will do a complete read up on
URLRewriter, could you give me quick heads up based on your experience of
this tool, if it handles HTTP Post request and does it preserve my
parameters. ?

Thanks,
Anand

On Tue, Mar 3, 2009 at 5:18 PM, André Warnier <aw...@ice-sa.com> wrote:

> Tim Funk wrote:
>
>> Doable : Yes
>> Out of the Box: No
>>
>> You can write a Servlet filter to examine the incoming hostname and
>> forward the request with the username prefix. In fact - you might need to
>> write it :  UrlRewriteFilter  - http://tuckey.org/urlrewrite/ might do it
>> for you.
>>
>>  +1
> In Tomcat and for that kind of thing, the UrlRewriteFilter is to my
> knowledge the most flexible tool to do this.
>
> You can also do this at the level of the front-end Apache if you already
> have one anyway.  Basically the UrlRewriteFilter was originally inspired by
> what one can do with the Apache httpd mod_rewrite module.
>
> If you already do some selective mapping at the Apache level (for example
> to have static content delivered by Apache and dynamic content by Tomcat),
> then I would think that it would be more logical to do this at the level of
> Apache also, and keep your Tomcat configuration simple.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: A question about redirecton from users.mydomain.com to mydomain.com/users

Posted by André Warnier <aw...@ice-sa.com>.
Tim Funk wrote:
> Doable : Yes
> Out of the Box: No
> 
> You can write a Servlet filter to examine the incoming hostname and 
> forward the request with the username prefix. In fact - you might need 
> to write it :  UrlRewriteFilter  - http://tuckey.org/urlrewrite/ might 
> do it for you.
> 
+1
In Tomcat and for that kind of thing, the UrlRewriteFilter is to my 
knowledge the most flexible tool to do this.

You can also do this at the level of the front-end Apache if you already 
have one anyway.  Basically the UrlRewriteFilter was originally inspired 
by what one can do with the Apache httpd mod_rewrite module.

If you already do some selective mapping at the Apache level (for 
example to have static content delivered by Apache and dynamic content 
by Tomcat), then I would think that it would be more logical to do this 
at the level of Apache also, and keep your Tomcat configuration simple.


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


Re: A question about redirecton from users.mydomain.com to mydomain.com/users

Posted by Tim Funk <fu...@joedog.org>.
Doable : Yes
Out of the Box: No

You can write a Servlet filter to examine the incoming hostname and 
forward the request with the username prefix. In fact - you might need 
to write it :  UrlRewriteFilter  - http://tuckey.org/urlrewrite/ might 
do it for you.

-Tim

Anand HS wrote:
> Hi,
> I have a requirement where I need to configure my Tomcat server to accept
> any requests to users.mydomain.com and internally see what the value of
> 'users ' is and then serve the content from that user subdirectory on
> www.mydomain.com.
> 
> For eg, if the URL is johndoe.mydomain.com my tomcat should internally map
> this to www.mydomain.com/johndoe and render index.html in johndoe subfolder.
> 
> 
> Is this type of configuration possible in tomcat. ? Or is this possible in
> apache server . ?
> 
> Apologise for posing a question that might have answers in apache server.
> But i put it here as i want to solve this using tomcat only if it can solve
> the problem.
> 
> Thanks,
> Anand
> 


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