F5 is upgrading its customer support chat feature on My.F5.com. Chat support will be unavailable from 6am-10am PST on 1/20/26. Refer to K000159584 for details.

Forum Discussion

KF5_129106's avatar
KF5_129106
Icon for Nimbostratus rankNimbostratus
Jul 16, 2013

uri rewrite

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.

 

 

 

 

2 Replies

  • Your traffic isn't going to get sent over to the www.example2.com VIP by rewriting the HTTP host header. That is going to send traffic on to the pool behind the www.example1.com VIP but with a new HTTP host header. In order to actually send traffic over to another VIP you are going to need an HTTP redirect.

     

     

    Hope that helps.

     

     

    Richard
  • I understand, thank you for the information.

     

     

    If I redirect the url at client end gets changed. Is there any other way than redirect, to send the traffic to example2.com without user browser getting updated?