You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sai A <ar...@gmail.com> on 2010/11/02 18:45:52 UTC

[users@httpd] Complex URL Mapping

Hi,

I am trying to figure out how to achieve the following with Apache HTTP
Server 2.0 which routes all request to a cluster of application servers.

I have a bunch of applications running on various subdomains on a site.
Broadly there are 3 categories of sites running on a domain name
www.company.com.

1) productx.company.com
These are more or less static sites.

2) client1.company.com, client2.company.com etc.
These are the homepages of the clients' sites.

3) admin.company.com
This is the admin site where all the clients can login to see client
specific details that relate to the company, update their profiles etc. So
client1 uses the URL admin.company.com/dashboard/client1 for his admin
login.

Now *some* of the clients want to move to their own domain names. They want
to be able to access their homepage (client1.company.com) at www.client1.com.
And their admin dashboard at www.client1.com/dashboard. However the first
category of sites above still needs to remain operational and category 2 and
3 would need to be operational as well (for those who don't opt for their
own domain names)

To summarise:
1) productx.company.com
2) client1.company.com --> www.client1.com (for some clients alone)
3) admin.company.com/dashboard/client1 --> www.client1.com/dashboard (for
the same clients in 2)

I have been reading the documentation to figure out the best way to do this.
Initially it looked like I could achieve it using a simple configuration of
ProxyPass and ProxyPassReverse like the following (just the small excerpt)
for each of the clients who opts for his own domain name.

<VirtualHost client1.com>

Server client1.com

ProxyPass /         http://client1.company.com
ProxyPass /dashboard/        http://admin.company.com/dashboard/client1/
ProxyPassReverse /           http://client1.company.com/
ProxyPassReverse /dashboard/
http://admin.company.com/dashboard/client1/

<Location /dashboard/client1/>
ProxyHTMLURLMap /       /dashboard/
</Location>

</VirtualHost>

My first question is would the above approach work for the above scenario (
productx.company.com working as always and the old and new client specific
URLs working as intended.)

There would be about 1000 clients for the company (or more, I am not sure).
I was wondering if there would be a simpler way to do it, without adding
virtual hosts for every client.

I was wondering if mod_rewrite would be the only approach if I don't want
virtual hosts for each client. I am not sure if I'd be allowed to create
virtual hosts, so would want to proceed to do that if that is the only way.
If there is some way that is easier/better than virtual hosts/mod_rewrite,
that would be great. Please do let me know your suggestions.

Any help is greatly appreciated. Thanks in advance.