Forum Discussion
Matthew_Hutchin
Nimbostratus
Jan 22, 2007Apache Virtual Hosts and Load balancing
I currently have a customer that is switching from an Apache Proxy server with Apache Virtual Hosts to and F5 BigIP LTM. I would like to know if anyone has eve done this and/or if it is possible to use the Apache Virtual Hosts and load balancing.
Thanks
Matt
11 Replies
- Colin_Walker_12Historic F5 AccountI don't see why it wouldn't be possible, on a general level. Is there a more specific task you're trying to perform?
Colin - Matthew_Hutchin
Nimbostratus
Thanks for you reply Colin. To be more specific, here is what they are trying to do.
on the outside they have something like https://mywebsite.bb.unc.edu and then internally they have https://hostname.bb.unc.edu. They are currently getting it done by using Apache Virtual hosts. - Andres_Villacis
Nimbostratus
Hi, Any have a response for this?
I resolve this in HTTP changing the servername in httpd.conf to the host domain in VS but using HTTPS the aplication response but the content is incomplete. I change the servername in ssl.conf in the apache configuration. - hoolio
Cirrostratus
Hi Andres,
You can use ProxyPass for this:
http://devcentral.f5.com/wiki/iRules.proxypassv10.ashx
Aaron - Andres_Villacis
Nimbostratus
Thanks hoolio,
Can you have an example to do this:
- have 7 server with apache named: www1.example.com, www2.example.com..... www7.example.com
- have 1 pool in the F5 for this with member 192.168.1.1:443.....192.168.1.7:443
- the defaul gw of servers is F5
- have 1 VS 203.1.1.1:443 with ssl termination and ssl server.
- the web page for the client is www.example.com, in DNS: www.example.com -> 203.1.1.1
needed: irule that rewrite the url go to pool via round robin or other:
if www1 is selected -> rewrite www.example.com/xyz for www1.example.com/xyz
if www2 is selected -> rewrite www.example.com/xyz for www2.example.com/xyz
if www3 is selected -> rewrite www.example.com/xyz for www3.example.com/xyz
...................................
if www7 is selected -> rewrite www.example.com/xyz for www7.example.com/xyz - Andres_Villacis
Nimbostratus
Thanks hoolio,
Can you have an example to do this:
- have 7 server with apache named: www1.example.com, www2.example.com..... www7.example.com
- have 1 pool in the F5 for this with member 192.168.1.1:443.....192.168.1.7:443
- the defaul gw of servers is F5
- have 1 VS 203.1.1.1:443 with ssl termination and ssl server.
- the web page for the client is www.example.com, in DNS: www.example.com -> 203.1.1.1
needed: irule that rewrite the url go to pool via round robin or other:
if www1 is selected -> rewrite www.example.com/xyz for www1.example.com/xyz
if www2 is selected -> rewrite www.example.com/xyz for www2.example.com/xyz
if www3 is selected -> rewrite www.example.com/xyz for www3.example.com/xyz
...................................
if www7 is selected -> rewrite www.example.com/xyz for www7.example.com/xyz - hoolio
Cirrostratus
For that, you can create a datagroup which maps the server IPs and corresponding hostnames. Then in the HTTP_REQUEST_SEND event, you can rewrite the host header:
For 9.4.x, you can use this example:
http://devcentral.f5.com/wiki/iRules.rewrite_host_header_to_server_name.ashx
For 10.x, you could use a name=value string datagroup and the class command to do the lookup:
http://devcentral.f5.com/wiki/iRules.class.ashx
Aaron - hoolio
Cirrostratus
Another option:
If you can update the virtual host definition in apache to accept the server IP in the host header, then you can eliminate the datagroup and lookup:from: http://devcentral.f5.com/wiki/iRules.http_request_send.ashx when HTTP_REQUEST_SEND { Need to force the host header replacement and HTTP:: commands into the clientside context as the HTTP_REQUEST_SEND event is in the serverside context clientside { Replace the HTTP host header with the connected server IP and port HTTP::header replace Host "[IP::server_addr]:[TCP::server_port]" } }
Aaron - Andres_Villacis
Nimbostratus
thanks, Hoolio.
The irule works fine when a default pool is selected in the GUI but when I add in the irule an pool selection the irule the aplication response but with errors in the content.
I am using V10.2.1 and the irule is:
bigip.conf:
class nombre {
{
host 192.168.2.10 { "www1one.example.com" }
host 192.168.2.20 { "www2one.example.com" }
host 192.168.2.30 { "www1two.example.com" }
host 192.168.2.40 { "www2two.example.com" }
host 192.168.2.50 { "www1one.test.com" }
host 192.168.2.60 { "www2one.test.com" }
}
}
irule:
when HTTP_REQUEST {
if { [HTTP::host] equals "www.example.com" and [HTTP::uri] starts_with "/one" } {
pool Pool_Example_One }
elseif { [HTTP::host] equals "www.example.com" and [HTTP::uri] starts_with "/two" } {
pool Pool_Example_Two }
elseif { [HTTP::host] equals "www.test.com" and [HTTP::uri] starts_with "/one" } {
pool Pool_Test_One }
}
when HTTP_REQUEST_SEND {
set host_debug 1
clientside {
if {$host_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: New [HTTP::method] request to [HTTP::host][HTTP::uri]"}
set host_header_value [class match -value [LB::server addr] equals nombre]
if {$host_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: Looked up [LB::server addr], found: $host_header_value."}
if {$host_header_value ne ""}{
HTTP::header replace Host $host_header_value
if {$host_debug}{log local0. "[IP::client_addr]:[TCP::client_port]: Replaced Host header with $host_header_value."}
}
}
} - nitass
Employee
it seems working fine to me. what was the error?[root@iris:Active] config b virtual bar list virtual bar { snat automap destination 172.28.17.33:http ip protocol tcp rules myrule profiles { http {} tcp {} } } [root@iris:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { if { [HTTP::host] equals "www.example.com" and [HTTP::uri] starts_with "/one" } { pool Pool_Example_One } elseif { [HTTP::host] equals "www.example.com" and [HTTP::uri] starts_with "/two" } { pool Pool_Example_Two } elseif { [HTTP::host] equals "www.test.com" and [HTTP::uri] starts_with "/one" } { pool Pool_Test_One } } when HTTP_REQUEST_SEND { set host_debug 1 clientside { if {$host_debug} {log local0. "[IP::client_addr]:[TCP::client_port]: New [HTTP::method] request to [HTTP::host][HTTP::uri]"} set host_header_value [class match -value [LB::server addr] equals nombr] if {$host_debug} {log local0. "[IP::client_addr]:[TCP::client_port]: Looked up [LB::server addr], found: $host_header_value."} if {$host_header_value ne ""} { HTTP::header replace Host $host_header_value if {$host_debug} {log local0. "[IP::client_addr]:[TCP::client_port]: Replaced Host header with $host_header_value."} } } } } [root@iris:Active] config b class nombr list class nombr { { host 10.10.70.201 { "www1one.example.com" } host 10.10.70.202 { "www1two.example.com" } host 10.10.70.211 { "www1one.test.com" } } } 1) www.example.com/one New TCP connection 1: 172.28.16.50(37170) <-> 172.28.17.33(80) 1318066155.9017 (0.0171) C>S --------------------------------------------------------------- GET /one HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: www.example.com Accept: */* --------------------------------------------------------------- New TCP connection 2: 10.10.72.30(37170) <-> 10.10.70.201(80) 1318066155.9021 (0.0003) C>S --------------------------------------------------------------- GET /one HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: www1one.example.com Accept: */* --------------------------------------------------------------- 2) www.example.com/two New TCP connection 1: 172.28.16.50(37200) <-> 172.28.17.33(80) 1318066205.3706 (0.0005) C>S --------------------------------------------------------------- GET /two HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: www.example.com Accept: */* --------------------------------------------------------------- New TCP connection 2: 10.10.72.30(37200) <-> 10.10.70.202(80) 1318066205.3711 (0.0003) C>S --------------------------------------------------------------- GET /two HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: www1two.example.com Accept: */* --------------------------------------------------------------- 3) www.test.com/one New TCP connection 1: 172.28.16.50(37217) <-> 172.28.17.33(80) 1318066233.1738 (0.0005) C>S --------------------------------------------------------------- GET /one HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: www.test.com Accept: */* --------------------------------------------------------------- New TCP connection 2: 10.10.72.30(37217) <-> 10.10.70.211(80) 1318066233.1743 (0.0002) C>S --------------------------------------------------------------- GET /one HTTP/1.1 User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 Host: www1one.test.com Accept: */* ---------------------------------------------------------------
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
