Forum Discussion

lancevo7_253506's avatar
lancevo7_253506
Icon for Nimbostratus rankNimbostratus
Mar 10, 2017

Irule to forward to pool AND block uri

Hi,

 

I have iapp used for multiple fqdn and pool I have an irule for host and pool but I need to add irule for a specific host to autorize only one uri data group list Probleme is this irule apply to all fqdn

 

Irule one :

 

when HTTP_REQUEST { if { [HTTP::host] eq "1.toto.com" } { pool pool_https_toto1 } elseif { [HTTP::host] eq "2.toto.com" } { pool pool_https_toto2 } }

 

Irule two :

 

when HTTP_REQUEST { if { [ class match [string tolower [HTTP::uri]] contains allowed_uris ] } { return else { drop } } }

 

I need to apply the second irule only on specific host, how i can do this ?

 

2 Replies

  • If you want to make a decision only if a specific pool member is selected, you can utilize LB_SELECTED event in order to match on the specific pool member before making further decision based on URI.

     

  • Not sure if I understand correctly, but if you want the second iRule to be effective only for a specific hostname, why don't you just add the same "if" condition as you did in the first iRule?

     

    if { [HTTP::host] eq "1.toto.com" } { if { [ class match [string tolower [HTTP::uri]]...etc } }

     

    The LB_SELECTED code above applies to a different scenario but I think there's a bit of confusion understanding what you are trying to do.