Forum Discussion
A_tech_85188
Nimbostratus
May 01, 2008Pool Redirect
Hello All,
I need to setup an irule, but am newbie to irule's.
I need it to do this.
When someone puts in www.samplesite.com/sample1
it directs them to the sample...
A_tech_85188
Nimbostratus
May 08, 2008Hi Aaron,
Thanks for that. I don't think I will need to use the getfield as we plan to send them to a default pool page that says something like "This site does not exist" I made some changes to the irule (See below). I wanted to run it by you before turning it up live on our Big IP. Does everything look correct to you?
Parse the URI to determine which pool to send requests to.
The pool string should match all the characters in the URI after the leading slash.
Example: The pool for URI '/ABC/' is pool_ABC
Change "default_pool" to the pool which should be used if the parsed pool name doesn't exist.
when HTTP_REQUEST {
Check if requested path is at least two characters long
if {[string length [HTTP::path]] > 1}{
Get the whole path minus the leading slash
set pool_string [string toupper [string range [HTTP::path] 1 end]
Try to set the pool based on the URI. If the pool name doesn't exist, catch the error.
if { [catch {pool pool_${pool_string}}]}{
The pool parsed from the URI didn't exist
log local0. "Error assigning pool to pool_${pool_string}"
Assign a default pool for this request
pool default_pool
}
}
}
Again thanks for all your help!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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