Forum Discussion
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
- richard_77048
Nimbostratus
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 - KF5_129106
Nimbostratus
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?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com