not sure if adding log command is helpful in troubleshooting.
e.g.
[root@ve1023:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
set www ""
if {[regexp {www} [HTTP::host]]} {
scan [HTTP::host] {%[^.].%[^.].%s} www host dom
} else {
scan [HTTP::host] {%[^.].%s} host dom
}
log local0. "[IP::client_addr]:[TCP::client_port]|[HTTP::host]|[HTTP::uri]|$www|$host|$dom"
if {not [regexp {domain|www|wsecure|ssl} $host]} {
log local0. "Caught a MS host $host, redirecting..."
HTTP::redirect "https://www.domain.com/MS/RedirectMS?site=hub&value=$host"
}
}
}
[root@ve1023:Active] config curl -I http://abc.com/test
HTTP/1.0 302 Found
Location: https://www.domain.com/MS/RedirectMS?site=hub&value=abc
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve1023:Active] config
Nov 14 00:40:24 local/tmm info tmm[4766]: Rule myrule : 172.28.65.150:53712|abc.com|/test||abc|com
Nov 14 00:40:24 local/tmm info tmm[4766]: Rule myrule : Caught a MS host abc, redirecting...
[root@ve1023:Active] config curl -I http://www.abc.com/test
HTTP/1.0 302 Found
Location: https://www.domain.com/MS/RedirectMS?site=hub&value=abc
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve1023:Active] config
Nov 14 00:40:31 local/tmm info tmm[4766]: Rule myrule : 172.28.65.150:53713|www.abc.com|/test|www|abc|com
Nov 14 00:40:31 local/tmm info tmm[4766]: Rule myrule : Caught a MS host abc, redirecting...
additionally, i think it would be great if we can avoid using regex. you know it is cpu intensive.