Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

New to iRule and need it for this scenario

mariovallo
Nimbostratus
Nimbostratus

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 1

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