You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mike Curwen <gb...@gb-im.com> on 2003/08/13 01:23:48 UTC
From which apache virtual host did a request come from?
Basically, we have one apache instance going through the jk connector to
one tomcat instance. Plenty of virtual hosts.
1) Is it possible to mount several virtual hosts to the same web
application (the default one, as it happens)
2) Once the request is at that application, what's the best way to
determine from which virtual host it was sent?
One solution would be to chop of the URI part of the URL.
That would give me the http://www.foo.com:port/ part
Perhaps though, I could use a header. Like 'referrer'. But I am always
hearing about trouble with that particular header. Firewalls mess with
it, proxies mess with it, privacy advocates mess with it. Perhaps a
weird Apache/jk configuration messes with it.
What are the issues surrounding 2) ?
Thanks
Re: From which apache virtual host did a request come from?
Posted by John Turner <to...@johnturner.com>.
Mike Curwen wrote:
> 1) Is it possible to mount several virtual hosts to the same web
> application (the default one, as it happens)
I think this is possible, though maybe not desired.
You can see this with the manager app. Setup a bunch of virtual hosts
that have the same appBase, with Contexts that have the same docBase,
and you will be able to reach the same application on any of the host
names. I determined that it was better to give a separate appBase to
each virtual host.
If you mean setting separate appBase's for each virtual host, and still
being able to access the same webapp (Context with the same docBase not
a copy of the webapp in another docBase), I would say "no". It's at
least a security risk. Someone please correct me if I'm wrong.
> 2) Once the request is at that application, what's the best way to
> determine from which virtual host it was sent?
>
> One solution would be to chop of the URI part of the URL.
> That would give me the http://www.foo.com:port/ part
I think this makes the most sense. Using a token of "/" it wouldn't be
too hard to get everything between the second and third token.
John
Re: From which apache virtual host did a request come from?
Posted by John Turner <to...@johnturner.com>.
Mike Curwen wrote:
> 1) Is it possible to mount several virtual hosts to the same web
> application (the default one, as it happens)
I think this is possible, though maybe not desired.
You can see this with the manager app. Setup a bunch of virtual hosts
that have the same appBase, with Contexts that have the same docBase,
and you will be able to reach the same application on any of the host
names. I determined that it was better to give a separate appBase to
each virtual host.
If you mean setting separate appBase's for each virtual host, and still
being able to access the same webapp (Context with the same docBase not
a copy of the webapp in another docBase), I would say "no". It's at
least a security risk. Someone please correct me if I'm wrong.
> 2) Once the request is at that application, what's the best way to
> determine from which virtual host it was sent?
>
> One solution would be to chop of the URI part of the URL.
> That would give me the http://www.foo.com:port/ part
I think this makes the most sense. Using a token of "/" it wouldn't be
too hard to get everything between the second and third token.
John
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org