Forum Discussion
Kai_Wilke
Aug 16, 2016MVP
Hi Ibrahim,
you may take a look to the iRule below. It used a less complex syntax using the
[URI::*]
commands to parse the original Location
header to decide if a rewrite is needed. But also uses a -glob
based [string match]
command to identify IPs within the host values.
when HTTP_RESPONSE {
if { [set http_location [HTTP::header value "Location"]] ne "" } then {
if { ( [set uri_port [URI::port $http_location]] >= 9080 ) and
( $uri_port <= 9199 ) and not
( [string match {[0-9]*.[0-9]*.[0-9]*.[0-9]*} [URI::host $http_location]] ) } then {
HTTP::header replace Location "[substr $http_location 0 ":$uri_port"][findstr $http_location ":$uri_port" 5]"
}
}
}
Cheers, Kai