Forum Discussion
Al_s_296685
Oct 09, 2017Nimbostratus
ok, im getting there towards answering my own question.
any refinements on this would be appreciated:
when HTTP_REQUEST {
Check if path contains /monitoring
if {[HTTP::path] contains "/monitoring/"}{
use getfield to split the uri based on monitoring/ and then return the server name after that
set server_id [getfield [HTTP::uri] "monitoring/" 2 ]
log local0. "Server id: $server_id"
Replace /monitoring and servername in the path
set toremove [string range [HTTP::uri] [expr {[string first "/monitoring/" [HTTP::uri]]}] end]
log local0. "part of uri to remove: $toremove"
set replace "/"
set uri [string map [list $toremove $replace] [HTTP::uri]]
log local0. "New URI = $uri"
HTTP::uri $uri
redirect or rewrite uri?
HTTP::redirect "http://[HTTP::host]$uri"
pool "/Common/${server_id}"
}
}