Forum Discussion
Mike_Perez_6161
Nimbostratus
Feb 18, 2010Parse the first and second character in the path?
I know what I have got below is not parsing the second character but is sort of displaying the concept.
Can some please give me a hand in the simplest form?
when HTTP_REQUEST {
Parse the first character in the path
switch -glob [HTTP::path] {
"/[a-alA-AL]*" {
pool reward-uat5.123.com_AA2AL
}
"/[am-blAM-BL]*" {
pool reward-uat5.123.com_AM2BL
}
"/[bm-cdBM-CD]*" {
pool reward-uat5.123.com_BM2CD
}
default {
Requested URI was a leading forward slash only
pool reward-uat5.123.com_AA2AL
}
}
}
- hoolio
Cirrostratus
Hi Mike, - Mike_Perez_6161
Nimbostratus
Aaron, - hoolio
Cirrostratus
That's a novel solution! You can logically set the path to lower case without modifying the actual path that in the request sent to the pool. This allows you to remove some switch cases. You can also combine multiple cases where the action is the same:when HTTP_REQUEST { Parse the first then second character in the path switch -glob [string tolower [HTTP::path]] { "/a[a-l]*" { pool reward-uat5.123.com_AA2AL } "/a[m-z]*" - "/b[a-l]*" { pool reward-uat5.123.com_AM2BL } "/b[m-z]*" - "/c[a-d]*" { pool reward-uat5.123.com_BM2CD } default { Requested URI was a leading forward slash only pool reward-uat5.123.com_AA2AL } } }
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