Sunday, April 7, 2013

F5 URI Re-write to simplify deploys

Our company had a US and a UK based domain, and for a long time we had to keep track of and deploy two separate copies of the site because a single URI was different. Luckily F5's iRules can take care of this.

What we wanted to happen was if you went to /business on the US site you'd hit one folder, and on the UK site you'd hit another folder. We have two separate VIP's for each site, and previously had deployed two separate copies of the /business folder, one for each VIP. With a simple iRule re-write, we can deploy the same code to the servers in each VIP, and still have each site direct you to the correct folder.

This iRule is applied on the UK VIP, and sends you to the correct folder.

when HTTP_REQUEST { set uri [HTTP::uri] switch -glob [string tolower [HTTP::uri] ] { "/business/*" { HTTP::uri "/business_uk/[string range $uri 10 end]" } } }
This iRule simply takes the URI. If it matches "/business/*" it transparently sends you to the /business_uk/ folder. Adding [string range $uri 10 end] takes any characters after the first 10 and attaches them on to the new URI. Doing this let you keep any other portion of the URI that may have been in the original request.


  1. Thank you for another magnificent post. Where else may anybody get that kind of information in such a perfect approach of writing? I've a presentation subsequent week, and I am at the look for such information. itunes login account

  2. A tenure payment allows for monthly payments for the life from the loan, whether or not the payments exceed the property value. mortgage calculator canada People need to keep in mind that if rates rise they are able to expect to possess a higher monthly payment even whenever they refinance into another IO loan. canada mortgage calculator