Forum Discussion

Tharun_91512's avatar
Tharun_91512
Icon for Nimbostratus rankNimbostratus
May 23, 2012

HTTP redirection when one server selected

There is a pool with 2 nodes in it. If the client is connecting to the first node then it should be served normally, but if client is connected to the second server then client should be redirected to http://second_node_ip/index.html

 

 

Can any one tell me how to write an irule for this. Thanks in advance !!

 

 

 

Regards,

 

Tharun

 

3 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    Tharun

     

     

    See if this works for you:

     

     

    when HTTP_REQUEST {

     

    Once pool member has been selected check if it's x.x.x.x

     

    if { [IP::addr [LB::server addr] equals x.x.x.x] } {

     

    HTTP::redirect "http://x.x.x.x/index.html"

     

    }

     

    }

     

     

    Info from https://devcentral.f5.com/wiki/irules.LB__server.ashx

     

     

    Rgds

     

    N
  • That Didn't worked Nathan. I am getting a connection reset page after putting that iRule.

     

     

    Regards,

     

    Tharun
  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    Tharun

     

     

    Do you need the redirect to go to the actual ip address or can the existing host just be used but adding the URI you mention above?

     

     

    when HTTP_REQUEST {

     

    Once pool member has been selected check if it's x.x.x.x

     

    if { [IP::addr [LB::server addr] equals x.x.x.x] } {

     

    HTTP::uri "/index.html"

     

    }

     

    }

     

     

    Rgds

     

    N