Forum Discussion

sandiksk_35282's avatar
sandiksk_35282
Icon for Altostratus rankAltostratus
May 23, 2018

can i combine 2 irules together.

We have 3 urls pointing to the a VS on f5. With 2 urls I need to allow specific IP from the http header ( looking for specific iv remote address),If the IP is in DG allow traffic to the VS if not reject.This is working fine. when HTTP_REQUEST { Traffic is allowed. Client IP match found in DG_QA if { [class match [HTTP::header iv-remote-address] eq "qa" ] }{ pool qa_pool } else { Traffic is dropped. Client IP match not found in DG_QA reject } }

 

With the 3rd url I need to look only a some specific content in the http header . and how can i achieve this by combining all this into a single irule.

 

2 Replies

  • Hi,

    you can already tests this irule:

    when HTTP_REQUEST {
    
    if { ([HTTP::uri] starts_with "/my/uri1" || [HTTP::uri] starts_with "/my/uri2") && [class match [HTTP::header iv-remote-address] eq "qa" ] } {
         condition (uri2 or uri2) and specific IP
    } elseif { ([HTTP::uri] starts_with "/my/uri1") && [HTTP::header exists "test"] && [HTTP::header "test"] eq "myValue" } {
         condition (uri1) and specific header name + specific header value
    } else {
         default
    }
    
    }
    

    let me now if it's what's you need and keep me update if you need additional info.

    Regards

  • use else if or switch to make sure the correctly parts are hit.

     

    if you can provide the three code snippets (formatted correctly) im sure someone will put it together.