Forum Discussion

Rudy_Torres_798's avatar
Rudy_Torres_798
Icon for Nimbostratus rankNimbostratus
Oct 13, 2006

Creating a data class in 9.x

I am trying to create a class in 9.x to allow only certain uri's to each web site. Here is the what the rule looks like.

 

 

class allowed_uris {

 

when HTTP_REQUEST {

 

if { ( [HTTP::host] contains "website1.com" ) or ( [HTTP::host] contains "website2" ) } {

 

pool pool1

 

} elseif { ( [HTTP::host] contains "website3.com" ) and ( [ matchclass [HTTP::uri] contains $::allowed_uris] ) } {

 

pool pool2

 

} elseif { ( [HTTP::host] contains "website4") and ( [ matchclass [HTTP::uri] contains $::allowed_uris ] ) } {

 

pool pool3

 

} else {

 

discard

 

}

 

}

 

 

I know the syntax is :

 

class allowed_uris { "images" "styles" }

 

but where or how is the class created?

2 Replies

  • Hi,

     

     

    A class in past versions is now referred to in the GUI as a datagroup. You can add/view them in the GUI under Local Traffic >> iRules >> Data Group List. It's in a tab along the top to the right of iRules.

     

     

    Also, the format for a rule in the GUI doesn't include the class allowed_uris { line. That would be how the class (datagroup) is shown in the bigip.conf file.

     

     

    Lastly, you might want to use 'string tolower' to do a case insensitive comparison for the host comparison, and in your URI test comparison if your web application is not case sensitive.

     

     

    Aaron