Forum Discussion
Kevin_Stewart
Aug 24, 2013Employee
I'd go with the data group method. It's by far the easiest to manage and requires no subsequent changes to the iRule. Example.
Data group - string-based (ex. my_uri_dg)
"/uri1"
"/uri2"
"/uri3"
"/uri4"
iRule:
when HTTP_REQUEST {
if { not ( [class match [string tolower [HTTP::uri]] starts_with my_uri_dg] ) } {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
So as long as the requested URI pattern (starts_with) is in the data group, the request will pass through. Otherwise, for everything else, it gets redirected. It doesn't appear that the host name changes, so you shouldn't have to evaluate that. Also note that we're just looking for data the group key, so the corresponding values can be empty.