We have two vips configured in two dirfferent DataCenters. We need to to rewrite the HTTP::header Host and uri based on content switching from one DC to another dc. This should be transparent to user.
http://example1.com/abc/admin (vip is in DC1)…should be changed to
http://example2.com/xyz/admin (this vip is in DC2)
My irule would be,
HTTP_REQUEST{
if { [string tolower [HTTP::uri]] contains “/abc” }
set uri [HTTP::uri]
HTTP::uri “/xyz[string range $uri 4 end]”
HTTP::header replace Host “example2.com”
}
else{
pool default_pool
}}
But this is not working. I am getting error, 400.
Any help would be greately appreciated.