Forum Discussion

Dennis_Watson_2's avatar
Dennis_Watson_2
Icon for Nimbostratus rankNimbostratus
Apr 21, 2008

Redirect URL to pool member permanently

Hi folks,

 

I've read dozens of entries trying to find an example that would allow me to do a permanent redirect to the pool member once it was selected.

 

This may require more than one iRule to execute.

 

1. Select the node using standard load balancing and monitors, etc.

 

2. Issue a redirect to the node.

 

 

Yes, it is a routeable IP in my intranet and yes, I want the client to see the new URL in the browser.

 

 

Something like:

 

http://abc.com

 

becomes

 

http://def.com (or http://1.1.1.2:80)

 

 

Connection is redirected, end of LTM processing.

 

 

I originally thought this was available as a simple GUI option, but can't find it.

 

 

Thanks all !!!

4 Replies

  • So you want the client to make the initial request to example.com which resolves to the VIP address and get an HTTP redirect to the selected node's IP address? If so, you could configure a standard VIP and pool and then add the following rule:

    
    when LB_SELECTED {
        Send redirect with the selected server's IP address
       HTTP::redirect http://[LB::server addr]
    }

    Aaron
  • I have a following query

     

    =======================

     

     

    we have a pool defined in which there are 6 members (i,e 6 servers) . Load balancing method used is round robin. Now the query is when a HTTP request comes on the LB from the external world then how we can see on the LB that to which specific pool member the request has been redirected to by the F5 . Is there any way we can check on the LB ?

     

    =======================================

     

  • Hi there,

    Do you want to log which pool member a request was sent to? If so, you can use an iRule to log this:

     
     when LB_SELECTED { 
      
        log local0. "[IP::client_addr]:[TCP::client_port]: pool info: [LB::server]" 
      
     } 
     

    This will log the client IP address:port and the selected pool member in the format of " ".

    I wouldn't suggest leaving this rule enabled on the VIP at all times as it will log one entry for every load balancing selection.

    If this isn't what you are trying to do, could you elaborate?

    Thanks,

    Aaron
  • Hi Hoolio,

     

    While configuring iRule, which suggested by you i am getting an error.

     

    when LB_SELECTED { Send redirect with the selected server's IP address HTTP::redirect http://[LB::server addr] }

     

    Its getting an error " command is not valid in current event context (LB_SELECTED)"

     

    can you help for this