Forum Discussion
Modify iRule to ignore case sensitivity in URI
when HTTP_REQUEST {
set uri [HTTP::uri]
if { $uri contains "/crn" } {
pool pdam.com-HTTP
} elseif { $uri contains "/dmz0431993" } {
pool www.domain.com-8683
} elseif { $uri contains "/dmz0431994" } {
pool www.domain.com-8683_appserv2
}
}
I'd like to setup it to ignore case sensitivity. In other words accessing http://www.domain.com/crn or http://www.domain.com/CRN would send me to the same pool. Same would also apply to the /dmz or /DMZ. Can someone please help.
Thanks,
-Pete
6 Replies
- The builtin TCL "string tolower" command should do what you want.
when HTTP_REQUEST { set uri [string tolower [HTTP::uri]] if { $uri contains "/crn" } { pool pdam.com-HTTP } elseif { $uri contains "/dmz0431993" } { pool www.domain.com-8683 } elseif { $uri contains "/dmz0431994" } { pool www.domain.com-8683_appserv2 } }
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/crn*" { pool pdam.com-HTTP } "/dmz0431993*" { pool www.domain.com-8683 } "/dmz0431994*" { pool www.domain.com-8683_appserv2 } }
- Pete_Paiva_7147
Nimbostratus
Awesome -- thanks so much for the help!! - Ahmed_Thabit_13
Nimbostratus
When I tried the switch command exactly as you explained it gave me an error message
01070151:3: Rule [Test123-redirect] error: line 4: [wrong args] [switch [string ToLower [HTTP::uri]]{ ] line 4: [invalid option "ToLower" must be: bytelength compare equal first index is last length map match range repeat replace tolower totitle toupper trim trimleft trimright wordend wordstart] [ToLower]
Any idea?
- nitass
Employee
01070151:3: Rule [Test123-redirect] error: line 4: [wrong args] [switch [string ToLower [HTTP::uri]]{ ] line 4: [invalid option "ToLower" must be: bytelength compare equal first index is last length map match range repeat replace tolower totitle toupper trim trimleft trimright wordend wordstart] [ToLower]
it is tolower (not ToLower).
- Ahmed_Thabit_13
Nimbostratus
I did and it still did not work.
Do I need the * after the matching pattern"/dmz0431994*"?
- nitass
Employee
I did and it still did not work.
what error did you get? can you post the irule?
Do I need the * after the matching pattern"/dmz0431994*"?
no. the pattern looks correct to me.
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