Forum Discussion

jermc777_185784's avatar
jermc777_185784
Icon for Nimbostratus rankNimbostratus
Nov 21, 2018

Irule Redirect with Datagroup

I have the following Irule and data group working (If I go to jerry.com/jerry it redirects me to http://www.msn.com/en-us/news) What I would like add to the functionality if possible is if I were to go to jerry.com/jerry/123 it redirect me to http://www.msn.com/en-us/news/jerry/123. So I would like it to remember the /jerry/123 and append that to the redirected url. Can anyone tell me if this is possible with the syntax of the irule and datagroup. Below are the contents of my irule and datagroup:

Name: datagroup_uri_list

    String: jerry.va.gov/jerry

    Value: www.msn.com/en-us/news

Irule is

        when HTTP_REQUEST {

          if { [class match [HTTP::host][HTTP::uri] equals datagroup_uri_list] }  {
                set redirect_value [class match -value [HTTP::host][HTTP::uri] eq datagroup_uri_list]
                HTTP::respond 302 Location  
                HTTP::redirect "http://$redirect_value" 
            }
        }

1 Reply

  • ​hi jermc777

    I am sure by now you have got your answer for this but if not you can look at this

     

    https://devcentral.f5.com/s/question/0D51T00006zve4ISAQ/irule-datagroup-redirect?tab=My+Questions&page=1