ibrahim_37929
Aug 16, 2016Nimbostratus
delete port i rule with specific address
Hi i use an i rule for deleting ports on application servers. But the problem is when i called the ip address:port of an application server i rule deletes the ports of application server. So i want to write an exception for the specific ip address. here is my i rule:
when HTTP_RESPONSE {
if {[HTTP::header exists "Location"]}{
set org_location [HTTP::header "Location"]
set http_part [substr $org_location 0 "//"]
if {$http_part eq "http:"}{
set remain_part [findstr $org_location $http_part 5]
}
elseif {$http_part eq "https:"}{
set remain_part [findstr $org_location $http_part 6]
}
set port_str [findstr $remain_part ":"]
set port_num [substr $port_str 1 4]
deletes the ports between 9080 and 9199
if {($port_num >= 9080) and ($port_num <= 9199)}
{
set the_port [substr $port_str 0 5]
set part1 [substr $org_location 0 $the_port]
set part2 [findstr $org_location $the_port 5]
if {$org_location contains $the_port}{
set org_location "$part1$part2"
HTTP::header replace Location $org_location}
}
}
}
I want to modify this irule so; if the url contains the ip address, i rule wouldn't delete the ports.
Thanks for your help