You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Antoine PICOLET <an...@sagem.com> on 2004/09/28 19:00:37 UTC

[users@httpd] location-based virtual hosts ??

Hello,

What are the possibilities to implement a kind of 'location-based virtual 
hosts', in which virtual hosts are all set on the same IP, DNS name and 
port, but are recognized by the first part of the URL context path?


My detailed problem :

I have to configure an Apache HTTP Server 2.0.48, running on a corporate 
platform, on which several 'web Applications' have to be integrated. My 
problem is :
 * I have no control on these Applications, which come from different 
companies. They all have to run in their own Virtual Host for 
configuration flexibility reason. I can however control the Virtual Host 
definitions and configuration; the Applications provides the configuration 
content of these Virtual Hosts.
 * All these Applications MUST be reached using the same DNS name, since 
we cannot control the DNS mapping at all (too bad for standard name-based 
virtual hosting, and even for IP-based one)

My current implementation uses a 'port-based virtual hosting' : I create, 
for each Application, a virtual host using :

Listen 1234
<VirtualHost *:1234>

//generate some stuff (logging in syslog, accesslog format, suexec 
user/group, etc)

//////////////////////////////////////////////////
//Include Application config here//
//////////////////////////////////////////////////

</VirtualHost>


However this IS ugly :
 * every Application manager is fighting hard to get the 80 port ; )
 * Application developers cannot know in advance which port they will 
receive, since I have to manage the repartition (not two Applications with 
the same port). This leads to a big complexity in their clients management 
and development (what URL ?)
 * most of all, inter-Application links they have to create are awful, 
since these links have to include the whole URL with the port of the 
target Application (http://myhost:1234/foo/bar.html). This is really a 
problem, since this also means they have to know the hostname of my 
corporate platform, which is likely to be duplicated several times, each 
time with a different hostname... 


So, my ideal solution would be to use some kind of 'location-based' 
virtual hosting, which would resolve all the above-stated problems. In 
that solution, every Application will always be accesible from port 80, 
and can link to each other with relative links. However this does not 
exist ...

The only solution I thought of is :

* keep creating port-based virtual hosts, exactly as before
* in the main virual host (port 80), use a set of rewrite rules (which I 
haven't figured out exactly, but I know it is feasible) to map a request 
to the '/myApplication1' location to the 'http://myhost:1234/' URL.

Obviously, this is really ugly too. It would make me create a lot of ports 
that shall never be used directly (how to forbid ?), and it could maybe 
create problem with some CGI when they return their URL to the client, 
which would maybe include the port...

Can anyone think of another solution allowing several Virtual Hosts to be 
created on the same IP address, DNS name and port ?


Re: [users@httpd] location-based virtual hosts ??

Posted by Tim Burden <ti...@burden.ca>.
Why can't you control the DNS mapping? If you could do even a DNS wildcard
*.yourhost.com A your.server.ip.addr

then you could do regular name-based vhosting.

I don't see how any solution will get around the problem that for inter-app
links, each will have to know something about how to reach the other app: a
subdomain, a port, a directory name, etc. So what's so bad about port
numbers?

----- Original Message ----- 
From: Antoine PICOLET
To: users@httpd.apache.org
Sent: Tuesday, September 28, 2004 1:00 PM
Subject: [users@httpd] location-based virtual hosts ??



Hello,

What are the possibilities to implement a kind of 'location-based virtual
hosts', in which virtual hosts are all set on the same IP, DNS name and
port, but are recognized by the first part of the URL context path?


My detailed problem :

I have to configure an Apache HTTP Server 2.0.48, running on a corporate
platform, on which several 'web Applications' have to be integrated. My
problem is :
 * I have no control on these Applications, which come from different
companies. They all have to run in their own Virtual Host for configuration
flexibility reason. I can however control the Virtual Host definitions and
configuration; the Applications provides the configuration content of these
Virtual Hosts.
 * All these Applications MUST be reached using the same DNS name, since we
cannot control the DNS mapping at all (too bad for standard name-based
virtual hosting, and even for IP-based one)

My current implementation uses a 'port-based virtual hosting' : I create,
for each Application, a virtual host using :

Listen 1234
<VirtualHost *:1234>

//generate some stuff (logging in syslog, accesslog format, suexec
user/group, etc)

//////////////////////////////////////////////////
//Include Application config here//
//////////////////////////////////////////////////

</VirtualHost>


However this IS ugly :
 * every Application manager is fighting hard to get the 80 port ; )
 * Application developers cannot know in advance which port they will
receive, since I have to manage the repartition (not two Applications with
the same port). This leads to a big complexity in their clients management
and development (what URL ?)
 * most of all, inter-Application links they have to create are awful, since
these links have to include the whole URL with the port of the target
Application (http://myhost:1234/foo/bar.html). This is really a problem,
since this also means they have to know the hostname of my corporate
platform, which is likely to be duplicated several times, each time with a
different hostname...


So, my ideal solution would be to use some kind of 'location-based' virtual
hosting, which would resolve all the above-stated problems. In that
solution, every Application will always be accesible from port 80, and can
link to each other with relative links. However this does not exist ...

The only solution I thought of is :

* keep creating port-based virtual hosts, exactly as before
* in the main virual host (port 80), use a set of rewrite rules (which I
haven't figured out exactly, but I know it is feasible) to map a request to
the '/myApplication1' location to the 'http://myhost:1234/' URL.

Obviously, this is really ugly too. It would make me create a lot of ports
that shall never be used directly (how to forbid ?), and it could maybe
create problem with some CGI when they return their URL to the client, which
would maybe include the port...

Can anyone think of another solution allowing several Virtual Hosts to be
created on the same IP address, DNS name and port ?


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] location-based virtual hosts ??

Posted by Joshua Slive <js...@gmail.com>.
[Please post in plain text.]

> What are the possibilities to implement a kind of 'location-based virtual hosts', in which
> virtual hosts are all set on the same IP, DNS name and port, but are recognized by the 
> first part of the URL context path? 
 
No.  But there are two solutions to your problem:

1. Do they REALLY need to be in separate virtual hosts?  Why?  Most
directives that can be put in a <VirtualHost> section can also go in a
<Directory> section under the virtual host.  Be more specific about
exactly why you think you need virtual hosts and perhaps we can help
you more.

2. Do the multiple-apache-installs on different ports technique, but
use ProxyPass and ProxyPassReverse on the port-80 install to map all
the other installs into the same namespace.  See the mod_proxy
documentation for details as well as
http://www.apacheweek.com/features/reverseproxies

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org