Forum Discussion

Cwoods-KCS's avatar
Cwoods-KCS
Icon for Nimbostratus rankNimbostratus
Dec 03, 2019

Redirect based on URI/RFC1918 to Pool

The request I have is that clients coming from RFC1918 IP's with Admin/admin in the URI will be sent to a server in another pool separate from the VS. If the client is NOT coming from an RFC1918 IP and tries the URI Admin or admin its redirect to the root of the web service. The only piece that isn't working is sending the traffic to the pool when client is on RFC1918 and is trying the URI. I do get a page to load but the page is on the pool member of the VS, not the one in the iRule. The data group for 'rfc1918' is created and accurate.

 

when HTTP_REQUEST {

set req_uri [HTTP::uri]

if { ([class match [IP::remote_addr] eq rfc1918]) } {

}

elseif {$req_uri contains "Admin" or

$req_uri contains "admin" or

pool xyz_pool

}

elseif { (![class match [IP::remote_addr] eq rfc1918]) } {

HTTP::redirect "http://abc.com"

}

}

4 Replies

  • Hi,

    Can you try this iRule?

    when HTTP_REQUEST {
    	if { [string tolower [HTTP::uri]] contains "admin" } {
    		if { not ([class match [IP::client_addr] equals private_net]) } {
    			HTTP::redirect "http://abc.com"
    		}
    	}
    }

    The BIG-IP system includes pre-configured private_net data group.

    • Cwoods-KCS's avatar
      Cwoods-KCS
      Icon for Nimbostratus rankNimbostratus

      In this iRule where is the part to send to the pool xyz_pool if hte client IP is RFC1918?

  • when HTTP_REQUEST {
    	if { [string tolower [HTTP::uri]] contains "admin" } {
    		if { not ([class match [IP::client_addr] equals private_net]) } {
    			HTTP::redirect "http://abc.com"
    			pool xyz_pool
    		}
    	}
    }
    • Cwoods-KCS's avatar
      Cwoods-KCS
      Icon for Nimbostratus rankNimbostratus

      Same result as with my previous iRule, the client's with private IP's and looking for the uri /admin end up landing on the VS pool member and not the iRule defined pool member.