Forum Discussion

John_Fretwell_1's avatar
John_Fretwell_1
Historic F5 Account
Nov 06, 2006

L4 TCP redirect to simulate HTTP redirect

I have a requirement for a v9.2.3 Link Controller (no L7 iRules or HTTP redirect within the http profile) to be able to redirect to a holding page when all pool members are down.

 

 

Below is the iRule I have written, however, the BIG-IP resets the connection and the redirect is never acheived. Is it possible to construct a successful http redirect at layer 4?

 

 

Many thanks.

 

 

My last attempt was ...

 

 

when CLIENT_ACCEPTED {

 

if {[active_members pool_80]< 1}{

 

TCP::respond "HTTP/1.0 302 Found\r\n Response code: 302\r\n Server: BIG-IP\r\n Location: http://holdingpage.domain.com\r\n Connection: close\r\n\r\n"

 

TCP::close

 

return}

 

}
  • The problem is that the units are only running LC and not the full LTM software. The fallback host used to be available in ver 4.5 LC but seems to have disapeared in version 9.

     

    In the wideip conf page there is an option to use fallback IP but this does not work for us as we need to use a FQDN, as the server we are falling back to hosts multiple sites and relies on host headers. If you enter the FQDN as the fallback IP it gets resolved to the server IP and we get redirected to the incorrect page.

     

     

    Thanks

     

     

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    If the connection is being reset, there should be an error in the /var/log/ltm log file. Can you post that here?
  • John_Fretwell_1's avatar
    John_Fretwell_1
    Historic F5 Account
    I has some more time today to debug my iRule. It turns out that spaces are critical in the tcp response if it is to be interpreted as an http response. The working iRule is:

     

     

    when CLIENT_ACCEPTED {

     

    if {[active_members pool_80]< 2}{

     

    TCP::respond "HTTP/1.0 302 Found\r\nServer: BIG-IP\r\nLocation: http://holdingpage.domain.com\r\nConnection: close\r\n\r\n"

     

    TCP::close

     

    return}

     

    }

     

     

    Many thanks for your interest though.

     

     

    Best regards

     

     

    jrf.