Forum Discussion
Kevin_Stewart
Jul 06, 2013Employee
Maybe something like this:
when HTTP_RESPONSE {
if { [HTTP::is_redirect] } {
set host_new "newHost.com"
set uri_old [string tolower [HTTP::header Location]]
if { [scan $uri_old {%*[http://|https://]%[^/]} host_old] } {
set map_exp "set uri_new \[string map {$host_old $host_new} $uri_old\]"
eval $map_exp
HTTP::header replace Location $uri_new
}
}
}
Using the scan and string map commands are just a few ways to do all of this.