Forum Discussion
dlegate_23320
Nimbostratus
Mar 09, 2012iRule to Migrate to new server based on URL (directory) text?
Can iRules direct requests to a specific server/s based on text in the URL?
Scenario:
We have an old production server (physical) that is NOT load balanced.
We have new virtual servers to replace that server.
Instead of doing one massive cut-over for all the applications on this server, we wondered if we put the phyiscal server behind the F5 (with the new virtual replacements).
At first, we make sure ALL requests only go to server1.com (original physical server).
Then, when each application is "ready" on the new servers, one-by-one we add their directory name to an iRule and based on that, the request goes to the new server/s instead of the old.
For example, let's say we have an application at:
https://server.com/app1/
still being delivered from server1.com. But we've moved all its code to server2.com and server3.com, and they are ready to start handling those requests.
We add an iRule that sees "app1" in the URL and makes sure those requests are ONLY handled by server2.com and server3.com and NEVER by server1.com.
Is that possible with an iRule?
Thanks!
Dan
- hoolio
Cirrostratus
Hi Dan,when HTTP_REQUEST { switch -glob [string tolower [HTTP::path]] { "/app1*" { pool app1_pool } "/app2*" { pool app2_pool } default { pool default_pool } } }
when HTTP_REQUEST { switch -glob [string tolower [HTTP::path]] { "/app1*" - "/app2*" - "/app3*" { pool app2_pool } default { pool default_pool } } }
- Hamish
Cirrocumulus
Just an aside. Although doing the globs above is quick and easy (and performs well too), you will run the risk of breaking your site a little if you get the irule wrong when editing it on the fly (changing logic is always interesting ;) and if you have a lot of sites it will quickly get to be quite long... - dlegate_23320
Nimbostratus
Thanks to you both!
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