Forum Discussion
Siddharth_Sezhi
Nimbostratus
Sep 27, 2006need to make url redirects to be case in-sensitive
We wanted to redirect to a particular site when the url has /abc i implemented irule like the one below. It seems to work but the problem is its case sensitive. when client /ABC or /Abc except for the exact /abc it doesnt seem to work. we wanted to make it case in-sensitive. Kindly help me in this regard.
when HTTP_REQUEST {
if { [HTTP::uri] ends_with "cgi" } {
pool cgi_pool
} elseif { [HTTP::uri] starts_with "/abc" } {
pool abc_servers
}
}
Regards
Siddharth S
2 Replies
- surrounding the HTTP::uri with a "string tolower" command should do the trick. But, you'll probably want to do it for each conditional statement. An alternative, and more optimal, approach would be to use a switch statement like this:
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "*cgi" { pool cgi_pool } "/abc*" { pool abc_servers } } }
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] ends_with "cgi" } { pool cgi_pool } elseif { [string tolower [HTTP::uri]] starts_with "/abc" } { pool abc_servers } }
when HTTP_REQUEST { set uri [string tolower [HTTP::uri]] if { $uri ends_with "cgi" } { pool cgi_pool } elseif { $uri starts_with "/abc" } { pool abc_servers } }
- Siddharth_Sezhi
Nimbostratus
Hi Joe,
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