edward_snajder_
Aug 18, 2007Nimbostratus
Multiple domains to single IP
I am pointing multiple domains to a single IP on the F5. Say I have
domaina.com
domainb.com
domainc.com
and they are all pointing to 10.1.1.1 in DNS. I have an irule that will take [HTTP::host] and then decide if it is going to a virtual directory on IIS.
10.1.1.1/domaina
10.1.1.1/domainb
10.1.1.1/domainc
10.1.1.1 is the F5 server which load balances off to two IIS servers with hypothetical IPs of 10.1.2.1 and 10.1.3.1. The IIS servers are defined as nodes in the pool serving a VS for this multiple domain configuration.
when HTTP_REQUEST {
if { [domain [HTTP::host] 2] equals "domaina.com" }
{
HTTP::redirect http://[HTTP::host]domainA[HTTP:uri]
HTTP::redirect http://10.1.1.1/domainA
}
elseif { [domain [HTTP::host] 2] equals "domainb.com" }
{
HTTP::redirect http://10.1.1.1/domainB
}
elseif {[domain [HTTP::host] 2] equals "domainc.com" }
{
HTTP::redirect http://10.1.1.1/domainC
}
}
This gets everything to where I want it to go (so far, I'm new at this and I haven't tested anything except a single page yet, and there is probably a better way to do this), but, the address bar comes up with http://10.1.1.1/domainc. Since they are public-facing websites, it would be nice to maintain the http://domaina.com/domaina or ideally just http://domaina.com.
When trying the commented out piece, that just results in a loop because it continues to redirect itself. Perhaps there is better logic to run the condition against, or maybe I have the wrong approach. Any ideas? It would be great to sort that out, as then you could have conceivably infinite domains running different sites from a single IP. One problem I am facing short term is that I am running out of IP addresses.
It also crossed my mind to instead make virtual servers for each domain that spoke on the same IP address to the IIS servers, but different ports. Any input you might have would be most appreciated!