Forum Discussion
Syntax to Map Virtual-Server's Character with Data-Group which Contains Pool Name
Consider first that the [virtual] command will return the name of the virtual server that is processing this iRule. It's a completely internal process, so there's no chance of a case mismatch. For example, if the virtual server name is literally:
mY_bIg-Ip_ViP
then the [virtual] command will be guaranteed to return:
mY_bIg-Ip_ViP
Given this fact, you shouldn't need to do a [string tolower ] evaluation. The following is more appropriate:
[class match [virtual] equals dg_parveez_dynamic_pools]
Where the [string tolower ] function would be important is anywhere the client could affect the value. So for example, let's say 5 different clients open their browsers and enter the following URI value (respectively):
/this-is-a-test-uri
/This-is-a-test-uri
/This-is-a-test-URI
/This-Is-A-Test-Uri
/ThIs-Is-A-tEsT-uRi
In this case you have five different versions of the same URI. The backend server may not care about this, but iRule/TCL evaluations are case-sensitive. So to successfully match all 5 of these URIs, you must "normalize" the input.
if { [string tolower [HTTP::uri]] starts_with "/this-is-a-test-uri" }
Notice that because you're normalizing the input to an all lowercase value, your match string must also be lowercase. The same applies to data group lookups.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
