Forum Discussion

swo0sh_gt_13163's avatar
swo0sh_gt_13163
Icon for Altostratus rankAltostratus
May 04, 2015

Need to verify the iRule to replace HTTP Class

Hello Folks,

Seek for your quick help. I am working on a upgrade activity for one of the customers from 11.2.1 to 11.5.1. Where they have one HTTP Class containing RegEx, which isn't migrating to the latest release.

The HTTP Class looks as the following screenshot.

The iRule I have prepared looks as following, to serve the same purpose as HTTP Class. Could someone please confirm if it looks correct or require any modification?

when HTTP_REQUEST {
        if {[HTTP::uri] matches_regex {"(?i)/testuri.*"} and [HTTP::header "header_sosproject"] contains "SOS_project"} {
            pool pool_sos
        }
}

Cheers! Darshan

2 Replies

  • I'm not certain what you are trying to match, but I think you have an error in your RegEx. I think you would want "(?i)/testuri.*" if you want to match any characters after /testuri The way you have it, it would match /testuri, or testurii, or /testuriiiii.

     

    I realize that /testuri is just an example, but I still think you would want the .* at the end of your regex string.

     

  • Thanks Robert, Appreciated!

     

    Updating the iRule snippet according to the suggestion, in case if someone want to use the similar example, would help.

     

    Cheers! Darshan