It's been awhile but I'm back on this. I tried the above iRule but it doesn't seem to rewrite the hostname. Here is the rule I'm using and some log entries that show it's not rewriting the hostname:
when HTTP_REQUEST {
if { [HTTP::host] equals "abc.com" } {
log local0. "orig hostname [HTTP::host]"
HTTP::header replace Host "www.[HTTP::host]"
log local0. "rewritten hostname is [HTTP::host]"
}
}
Aug 10 18:04:36 127.1.1.3 tmm1[2341]: Rule hostname_rewrite : orig hostname abc.com
Aug 10 18:04:36 127.1.1.3 tmm1[2341]: Rule hostname_rewrite : rewritten hostname is abc.com