Forum Discussion
A_tech_85188
Nimbostratus
18 years agoPool 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...
hoolio
Cirrostratus
17 years agoThat looks about right. Is the portion of the URI always the same length? ie, are your pool names pool_SAMPLE1, pool_SAMPLE2, etc? If so, you can change the command to:
set pool_string [string toupper [string range [HTTP::path] 1 7]]
You can test the string range command using a simplified test rule:
when RULE_INIT {
Save a test path
set ::path "/sample1/path/to/file.ext"
Starting with the / as positiion 0, parse the path
set ::pool_string [string toupper [string range $::path 1 7]]
log local0. "\$::pool_string: $::pool_string"
}Here is the sample output from /var/log/ltm:
Rule : $::pool_string: SAMPLE1
Once you get that working, you can use the same command in the normal iRule. Just replace the test variable $::path with [HTTP::path].
set pool_string [string toupper [string range [HTTP::path] 1 7]]
Aaron