Forum Discussion
SSHSSH_97332
Jan 26, 2012Nimbostratus
Multiple IRules to same VS
i will do an Irule mentioned at the below link :
but at the same time i want to forward to specific Pool based on src ip of client , will i do 2 Irules & then apply to the VS ? or it should only be one combined IRules containing all ?
- SSHSSH_97332Nimbostratusi will do an Irule mentioned at the below link :
- natheCirrocumulusSSHSSH
- hoolioCirrostratusDo you want requests from the specific client IP to still get checked for the requested host header? If not, you could disable the HTTP_REQUEST event:
when CLIENT_ACCEPTED { Save VS default pool name set default_pool [LB::server pool] Check if client IP is 1.1.1.1 select second pool and skip the host header check in HTTP_REQUEST if {[IP::addr [IP::client_addr] equals 1.1.1.1]}{ Select the second pool pool second_pool event HTTP_REQUEST disable } } when HTTP_REQUEST { switch [string tolower [URI::host [HTTP::uri]]] { youtube.com - www.youtube.com - 4shared.com - www.4shared.com - rapidshare.com - www.rapidshare.com { pool cache_pool } default { pool $default_pool } } }
- SSHSSH_97332NimbostratusThanks All , but my target exactly is :
- SSHSSH_97332NimbostratusSo what would be final IRules ?
- SSHSSH_97332Nimbostratusi need it with if else not with switch (if possible )
- SSHSSH_97332Nimbostratus.........
- nitassEmployeecan you try this?
when HTTP_REQUEST { switch [string tolower [HTTP::host]] { youtube.com - www.youtube.com - 4shared.com - www.4shared.com - rapidshare.com - www.rapidshare.com { set flag 1 } default { set flag 0 } } if {[class match -- [IP::client_addr] equals group1] and $flag} { pool proxy1 } elseif {[class match -- [IP::client_addr] equals group2] and $flag} { pool proxy2 } else { forward pool gateway } }
- SSHSSH_97332NimbostratusThanks alot nitass , but how can i use if/else instead of switch sothat all the IRule depends on if/else
- nitassEmployeedo you mean something like this? anyway, i do not get the point. why do you need if/else instead of switch??
when HTTP_REQUEST { if {[class match -- [string tolower [HTTP::host]] equals domain_list]} { set flag 1 } else { set flag 0 } if {[class match -- [IP::client_addr] equals group1] and $flag} { pool proxy1 } elseif {[class match -- [IP::client_addr] equals group2] and $flag} { pool proxy2 } else { forward pool gateway } }
Recent Discussions
Related Content
Â
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects