I’ve not been able to test it but this might work (of course, remove the logging once it does work);
Find the first element of the URI and lower it
set stringtolower [string tolower [findstr [HTTP::uri] "/" "0" "/"]]
log local0. "Lowered part of URI is: $stringtolower"
Extract the rest of the URI that we don't want to lower
set restofuri [findstr [HTTP::uri] $stringtolower "1"]
log local0. "Remaining URI is $restofuri"
Rebuild the URI and modify it before sending to the server
HTTP::uri /$stringtolower/$restofuri
log local0. "Rebuilt URI is /$stringtolower/$restofuri"
when HTTP_REQUEST {
going to split the URI on the "/" character and loop through the list
set newURI ""
for { set x 0 } { $x < [llength [split [HTTP::uri] "/"]] } { incr x } {
if { $x == 1 } {
this is the first path - the one we want to set to lowercase
append newURI "[string tolower [lindex [split [HTTP::uri] "/"] 1]]/"
} else {
append newURI "[lindex [split [HTTP::uri] "/"] $x]/"
}
}
the above append loop adds an unnecessary "/" at the end, so strip it here
set newURI [string range $newURI 0 end-1]
log local0. $newURI
}
or:
effectively splitting the first part of the URI away from everything else, in one long string manipulation statement
set newURI1 [string tolower [string range [HTTP::uri] 0 [string first “/” [HTTP::uri] 1]]][string range [HTTP::uri] [expr [string first “/” [HTTP::uri] 1] + 1] end]
log local0. $newURI1
Both just deal with the URI, so to get the full URL, just do this: