Forum Discussion
Joe_46466
Nimbostratus
May 21, 2009URL Rewriting of Hostname
We are upgrading a web farm, named "FarmA" and have built its replacement on new hardware. I have created a new pool named "FarmB". What I would like to do is this:
As applications are migrated from FarmA to FarmB they will have their IIS directory set to be a redirection on FarmA to FarmB, so that when the users type "http://FarmA/AppA/Index.htm" they will be redirected to "http://FarmB/AppA/Index.htm"
I would like to have an iRule in-place on FarmB to rewrite the URL so that the client sees the final address in their browser as "http://FarmA/AppA/Index.htm". This way no reference names have to change, bookmarks will still work, and the users will not know they are on the new farm.
Is this possible to achieve via an iRule? If so, can you provide an example?
Any help would be greatly appreciated!
- You have a couple of options with URL rewriting. In your case, if you want to maintain the original hostname, then all you'll have to do is modify the Host HTTP header in the HTTP_REQUEST event on it's way to the backend pool of servers. Something like this should do it:
when HTTP_REQUEST { if { [HTTP::header "Host"] eq "FarmA" } { HTTP::header replace "Host" "FarmB" } }
- Joe_46466
Nimbostratus
Joe, thank you for such a quick response on this! I should clarify, FarmA isn't on an F5 Load Balancer and I don't have any way to control it. I need to apply the iRule to the FarmB settings. - The_Bhattman
Nimbostratus
Then it's not going to work because you need to flip the client back to FarmA so it shows up on the browser. This would lead to a flip-flop between FarmA and FarmB.when HTTP_REQUEST { if { [HTTP::header "Host"] eq "FarmA" } { snat automap } }
when HTTP_REQUEST { if { [HTTP::header "Host"] eq "FarmA" } { HTTP::header replace "Host" "FarmB" } }
- Joe_46466
Nimbostratus
OK, then it looks as though I cannot do what I wanted. Basically, I was looking for a way to upgrade servers and migrate webs one-by-one onto the new hardware while retaining the same hostname.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects