Forum Discussion

B_Earp's avatar
B_Earp
Icon for Nimbostratus rankNimbostratus
Mar 24, 2014

v 11.5 irule - datagroup redirect

Hi,

 

Is there a version 11.5 irule that does redirection using a datagroup.

 

I have tried several from the forums: https://devcentral.f5.com/questions/irule-redirection-using-data-group-list-not-working https://devcentral.f5.com/articles/friendly-url-redirection-scaling-via-irules https://devcentral.f5.com/questions/sample-irule-for-redirect-rewrite https://devcentral.f5.com/questions/data-group-with-irule-301-redirects https://devcentral.f5.com/questions/redirect-datagroup

 

But none of them work. Any help would be much appreciated.

 

Thanks,

 

2 Replies

  • B_Earp's avatar
    B_Earp
    Icon for Nimbostratus rankNimbostratus
    Basically what we need is if the request matches /a, then redirect to /b.html, otherwise carry on.
  • Hi!

    Create a data group list called ie. redirect_dg and populate it with string and values (ie value /a equals /b.html).

    Then try this iRule:

    when HTTP_REQUEST {
    
        set path [string tolower [HTTP::path]]
    
        if { [class match $path equals redirect_dg] } {
    
            HTTP::respond 301 location "https://[HTTP::host][class lookup $path redirect_dg]"
    
        }
    
    }
    

    /Patrik