not sure if i understand the question correctly.
e.g.
config
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar
ltm virtual bar {
destination 172.28.24.10:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 41
}
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm pool foo
ltm pool foo {
members {
200.200.200.101:80 {
address 200.200.200.101
}
}
}
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux
ltm rule qux {
when RULE_INIT {
set static::org_host "abc.test.com"
set static::new_host "abc.test.net"
}
when HTTP_REQUEST {
if { [scan [HTTP::uri] {/%[^/]} prefix] != 1 } {
Exit if no prefix
return
}
if { [HTTP::host] equals $static::org_host } {
Insert prefix to Host header
HTTP::header replace Host "${prefix}.${static::new_host}"
Delete prefix from URI
HTTP::uri [string map [list "/${prefix}/" "/" "/${prefix}" "/"] [HTTP::uri]]
}
}
when HTTP_RESPONSE {
if { [HTTP::header exists Location] } {
Extract prefix from Location header
scan [URI::host [HTTP::header Location]] {%[^.]} prefix
Move prefix from Host to URI in Location header
HTTP::header replace Location [string map [list "${prefix}.${static::new_host}/" "${static::org_host}/${prefix}/"] [HTTP::header Location]]
}
}
}
trace
[root@ve11a:Active:In Sync] config ssldump -Aed -nni 0.0 port 80
New TCP connection 1: 172.28.24.1(48014) <-> 172.28.24.10(80)
1404023233.7475 (0.0016) C>S
---------------------------------------------------------------
HEAD /something/bhabhabha 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
Accept: */*
Host: abc.test.com
---------------------------------------------------------------
New TCP connection 2: 200.200.200.14(48014) <-> 200.200.200.101(80)
1404023233.7619 (0.0141) C>S
---------------------------------------------------------------
HEAD /bhabhabha 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
Accept: */*
Host: something.abc.test.net
---------------------------------------------------------------
1404023233.7757 (0.0138) S>C
---------------------------------------------------------------
HTTP/1.1 302 Found
Date: Sun, 29 Jun 2014 06:15:51 GMT
Server: Apache/2.2.3 (CentOS)
Location: http://something.abc.test.net/somethingelse/bhabhabha
Content-Type: text/html; charset=iso-8859-1
---------------------------------------------------------------
1404023233.7759 (0.0283) S>C
---------------------------------------------------------------
HTTP/1.1 302 Found
Date: Sun, 29 Jun 2014 06:15:51 GMT
Server: Apache/2.2.3 (CentOS)
Location: http://abc.test.com/something/somethingelse/bhabhabha
Content-Type: text/html; charset=iso-8859-1
---------------------------------------------------------------