String tolower within a switch -glob

We are routing traffic to various Pools by their URI. Our developers are implementing a change to the name of the of the incoming URI and need it to point to the existing Virtual Directory on the server. It works using a string map but it has to be the correct case. I have a string tolower with the switch -glob but it doesn’t carry over when it matches on the string map. Is there a way to have both of the functions string tolower?

when HTTP_REQUEST {

switch -glob [string tolower [HTTP::uri]] {
    "/vd/service/*" {
                       HTTP::uri [string map {"/VD/service/" "/change1/"} [HTTP::uri]]
                                 pool Pool_service}
    "/vd/forms/*" {
                       HTTP::uri [string map {"/VD/Forms/" "/change2/"} [HTTP::uri]]
                                 pool Pool_forms}
    "/vd/orders/*" {
                       HTTP::uri [string map {"/VD/Orders/" "/change3/"} [HTTP::uri]]
                                 pool Pool_orders}
    "/vd/contact/*" {
                       HTTP::uri [string map {"/VD/Contact/" "/change4/"} [HTTP::uri]]
                                 pool Pool_contact}
          default {
                discard
               }
         }

}

can you try -nocase?

string

http://www.tcl.tk/man/tcl8.4/TclCmd/string.htm

[root@ve11c:Active:In Sync] config  tclsh
% set uri /VD/Service/something
/VD/Service/something
%
% string map -nocase {/vd/service/ /change1/} $uri
/change1/something

Thanks nitass, that did it. This is what I have in place, in case anyone else needs it as a reference:

when HTTP_REQUEST {

switch -glob [string tolower [HTTP::uri]] {
    "/vd/service/*" {
                       HTTP::uri [string map -nocase {"/VD/service/" "/change1/"} [HTTP::uri]]
                                 pool Pool_service}
    "/vd/forms/*" {
                       HTTP::uri [string map -nocase {"/VD/Forms/" "/change2/"} [HTTP::uri]]
                                 pool Pool_forms}
    "/vd/orders/*" {
                       HTTP::uri [string map -nocase {"/VD/Orders/" "/change3/"} [HTTP::uri]]
                                 pool Pool_orders}
    "/vd/contact/*" {
                       HTTP::uri [string map -nocase {"/VD/Contact/" "/change4/"} [HTTP::uri]]
                                 pool Pool_contact}
          default {
                discard
               }
         }

}

use “string tolower” is not match string case

ex. when HTTP_REQUEST { if { [active_members [LB::server pool]] < 1} { switch -glob [string tolower [HTTP::uri]] { “/” { HTTP::respond 200 content [ifile get cproxy_index.html] “Content-Type” “text/html” log local0. “URI: [HTTP::uri]” } “/503/img_logo.gif” { HTTP::respond 200 content [ifile get img_logo.gif] “Content-Type” “image/jpeg” log local0. “URI: [HTTP::uri]” } “/503/logo_nomuraUN170-16.gif” { HTTP::respond 200 content [ifile get logo_nomuraUN170-16.gif] “Content-Type” “image/jpeg” log local0. “URI1: [HTTP::uri]” } default { HTTP::respond 200 content [ifile get logo_nomuraUN170-16.gif] “Content-Type” “image/jpeg” log local0. “URI2: [HTTP::uri]” } } } } this case when uri=“/503/logo_nomuraUN170-16.gif” is not match , default case "log local0. “URI2: [HTTP::uri]” output

whenever change switch -glob [string tolower [HTTP::uri]] ==>switch -glob [HTTP::uri]

then when uri=“/503/logo_nomuraUN170-16.gif” is match “/503/logo_nomuraUN170-16.gif” and log local0. “URI: [HTTP::uri]” output

string tolower is not use.