httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine PICOLET" <>
Subject [users@httpd] location-based virtual hosts ??
Date Tue, 28 Sep 2004 17:00:37 GMT

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


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 ?

View raw message