Forum Discussion
Need redirect irule help please !
I need a redirest irule, I can not use http class.
The developer only want the irule to act on the specifc uri path and send to pool1, any other uri path or no uri path at all goes to pool2.
http://test-swbc.com/akcelerant/
http://test-swbc.com/idsakcelerant/
http://test-swbc.com/idsakcelerantmtg/
http://test-swbc.com/lmakcelerant/
Vip: 10.200.1.62
Pool1 node: 10.16.5.50
Pool2 node: 10.25.25.100
Im lookiing for the I irule to use the if and else statements so that I can add more uri's as needed.
I'm not good a scripting so i realy need a completed irule that I can just paste with little editing. I can adjust the
nodes and uri's but the structure needs to be there compete. I not good at adding the brackets and quotes.
Thank you.
Correct, add another line after the first one. THe new line would look like
"/newuri/" -
and yes, it should match only the uri's as specified. Actually, it will be case-insenstive, so it would match the uri list no matter what combination of upper and lowercase characters. If you do not want that and only want it to match on lower case, then change the switch statement to:
switch -glob [HTTP::path]
4 Replies
- Pconlan_71037
Altocumulus
Here is how I do it.
------------------------------
when HTTP_REQUEST {
use tolower to make the match case-insensitive
switch -glob [string tolower [HTTP::path]] {
"/akcelerant/" -
"/idsakcelerant/" -
"/idsakcelerantmtg/" -
"/lmakcelerant/" {
pool pool1
}
default {
pool pool2
}
}
}
----------------------------------------
If you want all sub-uri's below the specified uri's to go to pool1 as well, then add a * at the end of each one, like "/akcelerant/*". - Gill_32697
Nimbostratus
Ok so if I need to add more uri path I could insert after first one..correct?
so this will match only the ones defined here otherwise pool2..correct?
Thank you very much Pconlan - Pconlan_71037
Altocumulus
Correct, add another line after the first one. THe new line would look like
"/newuri/" -
and yes, it should match only the uri's as specified. Actually, it will be case-insenstive, so it would match the uri list no matter what combination of upper and lowercase characters. If you do not want that and only want it to match on lower case, then change the switch statement to:
switch -glob [HTTP::path] - Gill_32697
Nimbostratus
awsome, Thank you very much Pconlan.
Recent Discussions
Related Content
* 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
