Forum Discussion
11 Replies
Sort By
- 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?
- Matthew_HutchinNimbostratusThanks for you reply Colin. To be more specific, here is what they are trying to do.
- Andres_VillacisNimbostratusHi, Any have a response for this?
- hooleylistCirrostratusHi Andres,
- Andres_VillacisNimbostratusThanks hoolio,
- Andres_VillacisNimbostratusThanks hoolio,
- hooleylistCirrostratusFor 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:
- hooleylistCirrostratusAnother option:
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]" } }
- Andres_VillacisNimbostratusthanks, Hoolio.
- nitassEmployeeit 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: */* ---------------------------------------------------------------