For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

rajesh1's avatar
rajesh1
Icon for Nimbostratus rankNimbostratus
Apr 09, 2010

Irule for Http redirect

Hi, I need some assistance in writing an irule for the following requirement for the http requests 1)Http://xyz.com redirect to "http://www.xyz.com" 2)If all the pool members are down - redirect "http://www.xyz.com" or "http://xyz.com" to "http://www2.xyz.com" 3)If LB_Failed then fall back to "http://www2.xyz.com" Is it recommended to have a single irule defined to match all the three requirements or 3 different irules for each requirements. Pls provide me with an irule definitions. Thanks, Raj

1 Reply

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi Raj,

     

     

    You can check the requested host using HTTP::host. You can send a redirect using HTTP::redirect "http://www.example.com/". You can use HTTP::fallback to set the fallback host. It would probably make sense to combine all of the logic in one rule.

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/http__host

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/http__redirect

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/http__fallback

     

     

    Aaron