Forum Discussion
Ralph_Duane_761
Nimbostratus
May 13, 2005Rookie needs help. iRule url redirection
I am a newbie with BigIP and not much of a coder either. I want to use BigIP to redirect traffic based on the url. If url contains tsa then goto one webpool and if it contains either tsa_test or tsa_train to goto another webpool. The base url is https. The webpools are http.
Can anyone help?
Thanks.
- JRahm
Admin
try this:rule URI_switch { when HTTP_REQUEST { set uri_info [HTTP::uri] if { $uri_info contains "tsa_test" or \ $uri_info contains "tsa_train" } { use pool pool_two } elseif { $uri_info contains "tsa" } { use pool pool_one } else { use pool default } } }
- Ralph_Duane_761
Nimbostratus
Thanks, citizen_elah. I am creating this rule thru the BigIP web admin interface. It is working but I had to strip out the section for using pool default. It was complaining that this was undefined when trying to update. - drteeth_127330Historic F5 AccountA trailing slash should not be required. I was not able to reproduce the problem with 9.0.5. What version are you using?
- Ralph_Duane_761
Nimbostratus
I am running version 9.0.4. - drteeth_127330Historic F5 AccountIs this an iRule problem? Did you include the final else in citizen_elah's example? Do you experience the problem if you set the pool on the virtual server to pool_one and remove the rule? What do the logs on the webserver show? Is BIG-IP truncating the URI somehow? Thanks.
- Ralph_Duane_761
Nimbostratus
I don't think this is a rule problem. Before the rule was in place, I still needed the / at the end of the url to get to the web page. I dod not include the final else condition because when completing the rule, it complained that this was undefined. I have also noticed that goiing to other secure sites that are unrelated to this in any way I have had to use the / at the end of the url. - JRahm
Admin
Is the problem with tsa only, or also with tsa_train and tsa_test?rule URI_switch { when HTTP_REQUEST { set uri_info [HTTP::uri] if {not {$uri_info ends_with "/"} } { append uri_info "/" } if { $uri_info contains "tsa_test" or \ $uri_info contains "tsa_train" } { use pool pool_two } elseif { $uri_info contains "tsa" } { use pool pool_one } else { use pool default } } }
- Ralph_Duane_761
Nimbostratus
citizen, I tried the code to add the / but that caused the pages not to be available whether or not I added the / to the end of the url. - JRahm
Admin
Maybe you should back up and do some diagnostic logging at this point:rule URI_switch { when HTTP_REQUEST { set uri_info [HTTP::uri] log "Variable uri_info contents: $uri_info" if {not {$uri_info ends_with "/"} } { append uri_info "/" log "Variable uri_info contents w\/ "\/" appended:" }
- unRuleY_95363Historic F5 AccountDon't forget to check /var/log/ltm as run-time errors are reported there. You are likely getting a run-time error when the page doesn't load. (log also outputs it's messages to /var/log/ltm).
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