For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

mariovallo's avatar
mariovallo
Icon for Nimbostratus rankNimbostratus
Apr 22, 2021

New to iRule and need it for this scenario

Hi guys, i need some help regarding the iRule so here's the scenario.

 

I have a VS named MY_VS

in this VS there are 2 iRules.

iRule1 is at the top and iRule2 is at the bottom.

 

iRule 1 is to Block HTTP OPTIONS method.

 

when HTTP_REQUEST {

if { ( [HTTP::method] equals "OPTIONS" ) } {

TCP::close

}

}

 

iRule 2 is to redirect request to specific pool based from URI

 

when HTTP_REQUEST {

if { [string tolower [HTTP::uri]] starts_with "/PAGE1" } {

pool MY_POOL_1

persist cookie insert PAGE1-COOKIE 0

} elseif { [string tolower [HTTP::uri]] starts_with "/PAGE2" } {

pool MY_POOL_2

persist cookie insert PAGE2-COOKIE 0

} elseif { [string tolower [HTTP::uri]] starts_with "/PAGE3" } {

pool MY_POOL_3

persist cookie insert PAGE3-COOKIE 0

} else {

pool MY_DEFAULT_POOL

}

}

 

Now The issue:

 

There is a request that requires HTTP OPTIONS to be forwarded/allowed to PAGE3 URI only.

for All other URI, HTTP OPTIONS must still be blocked.

 

Thanks for the answers.

 

 

 

 

 

1 Reply

  • when HTTP_REQUEST {
        if { ([HTTP::method] equals "OPTIONS") and ( not [string tolower [HTTP::uri]] starts_with "/page3") } {
        reject 
      } 
    }