Forum Discussion

Gill_32697's avatar
Gill_32697
Icon for Nimbostratus rankNimbostratus
Aug 22, 2016

Uri scalable redirects

having trouble with irule.i need to add these redirects based on the uri and will likely need y to add a few more so it need to be scalable. Programmers missed the missed the v3/ so Ii need an irule to correct as they add more uri's sites.... ! when HTTP_REQUEST { if { [string tolower [HTTP::uri]] equals {paymentprocessorv3/creditcard.asmx} { HTTP::redirect "https://mysite.zcorp.com/paymentprocessor/creditcard.asmx" } elseif{ [string tolower [HTTP::uri]] equals {paymentprocessorv3/ach.asmx} { HTTP::redirect "https://mysite.zcorp.com/paymentprocessor/ach.asmx" } }

 

--

1 Reply

  • If you need configuration scalability, why not maintain your src-path to redirect-dst mappings in a String-type LTM data group

    LTM -> iRules -> Data-group List
    . An alternative to data-groups is an iFile. AFAIK, both are good options but LTM Data-groups parsing should outperform iFiles.

    1. iRule Condition/Redirect statement:

    if { [class match [string tolower [HTTP::path]] equals data-group-paths] ) }{
      HTTP::respond 302 location "[class match -value [string tolower [HTTP::path]] equals data-group-paths"
    }
    

    2. data-group-paths (Type String) formatting:

    “/path1/asd.asmx”  value/description “https://somedomain.asd.com/1”
    “/path2/asd.asmx”  value/description “https://somedomain.asd.com/2”
    ...
    “/pathx/asd.asmx”  value/description “https://somedomain.asd.com/x”