DaveC_21078
Feb 07, 2011Altostratus
Change path
I have a URL where I need to alter the path, to eliminate the SSL in or w/o caring what comes afterSSL/. I thought it would fairly simple, but I can't get it to work. Thanks.
If it's going to show up anywhere in the URI it's a bit more tricky. You'd need to find where that is first, then use the string command to do away with that section, or re-write it as necessary.
Something like:
when HTTP_REQUEST {
set uri [tolower [HTTP::uri]]
if { $uri contains "/ssl/" } {
set index [string first /ssl/ $uri]
set newuri [string replace [HTTP::uri] $index [expr $index + 3]]
HTTP::uri $newuri
}
}
This would look for the first instance of /ssl/ and replace /ssl (chars 0-3 starting at the index) with nothing, effectively removing them from the URI.
Not tested on the LTM, but tested in tclsh for syntax.
Colin