The problem is the set command. The “HTTP::uri” command comes in two flavors, one to retrieve the value (if used with no parameters) and one to set the value (if a value parameter is given).
With that being said, a simpler way would be to avoid the append on the temporary variable and just change it with the HTTP::uri command.
set uri [HTTP::uri]
if { ! ([matchclass [string tolower [HTTP::uri]] contains $::WebFiles])
and ! ( $uri ends_with "/" ) } {
HTTP::uri "[HTTP::uri]/"
}
That’s due to an optimization in the caching of variables. The value of [HTTP::uri] is stored in a cache and when you re-assign the value with the “HTTP::uri value” command, the cached value for the [HTTP::uri] command is not updated. The URI will get modified, but the value returned from [HTTP::uri] is the original value. That issue has been around for a long time, maybe someday it’ll get fixed.
In the meantime, if you want to verify your changes with logging, I’d suggest you use a temporary variable.
when HTTP_REQUEST {
log local0. "in HTTP_REQUEST"
log local0. "Original: [HTTP::uri]."
set uri "/prefix[HTTP::uri]/what_the/"
log local0. "After mapping: $uri"
HTTP::uri $uri
}
You can verify this by looking at your backend webserver logs.