Hi Craig,
Here's an example which looks up the client's requested path (the /path/to/file.html in /path/to/file.html?param=value...). It does an exact match, but you could alter that by changing equals to starts_with.
when HTTP_REQUEST {
Check the requested path, set to lower case to see if it exists in the uri_map_dg datagroup
If there is a match, save the corresponding value
set new_path [class match -value -- [string tolower [HTTP::path]] equals uri_map_dg]
If there was a matching path, update the requested path
if {$new_path ne ""}{
HTTP::path $new_path
}
}
Here's an example for starts_with logic:
when HTTP_REQUEST {
Check the requested path, set to lower case to see if it exists in the uri_map_dg datagroup
If there is a match, save the corresponding name and value to do the update
set old_and_new_path [class match -element -- [string tolower [HTTP::path]] starts_with uri_map_dg]
If there was a matching path, update the requested path
Use string map to replace the old with the new in the path
if {$new_path ne ""}{
HTTP::path [string map $old_and_new_path [HTTP::path]]
}
}
Aaron