Dbow_21284
May 18, 2010Nimbostratus
Rewrite Host Header iRule on VS that changes to HOST Header on same VS
Hello guys,
I have a situation where our developers have a sight running on HTTPS that needs to rewrite the host header to a new host header, but DNS points it to the same VS on my LTM. I do have a clientssl profile so I can decrypt the traffic.
Important Points to consider:
1) I need to rewrite any requests that goto mydomain.net to sub.mydomain.net
2) DNS for mydomain.com and sub.mydomain.net both point to the same VS on the LB.
I have tried redirect iRules and HOST::HEADER replace iRules on my VS, but it doesn't appear to work. Here are examples of what I have done:
iRULE1:
Rewrite Host Header iRule
when HTTP_REQUEST {
if { [HTTP::host] equals "mydomain.net" } {
Rewrite host
HTTP::header replace Host sub.mydomain.net
}
}
iRULE2:
Redirect to sub.mydomain.net
when HTTP_REQUEST {
if {[HTTP::host] equals "mydomain.net" } {
HTTP::redirect https://sub.mydomain.net }
}
I am not sure why this doesn't work. I have used similar rules elsewhere. The only difference in those situations where it worked fine, is that the rewrite of the host header or redirect pointed to domain name that goes to different VS. Not sure if that is my issue. In both situations, the LB just lets the user access mydomain.com and nothing gets changed. I must be missing something here.
Any ideas as to why this wouldnt work or other approaches? Thanks in advance!
Denbownium