That looks like a good start. Can you provide a few more example URIs that you don’t want to redirect? Is there anything after /abc/000n?
It looks like you want to take the first directory in the path and check it against a datagroup containing strings. Do you also want to check the second directory to see if it’s numeric or four digits or something else?
Also, in 9.x/10.x you can use HTTP::redirect instead of “redirect to”.
That makes sense. If you define the datagroup as /abc/, /xyz/, then you can make the iRule simpler:
when HTTP_REQUEST {
if {not [matchclass [HTTP::uri] starts_with $::redirect_group]}{
Redirect to https
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
If the web app is not case sensitive, you could enter the class members in lower case and then set the URI to lower case by replacing [HTTP::uri] in matchclass with [string tolower [HTTP::uri]].