Forum Discussion

Nik2607's avatar
Nik2607
Icon for Altostratus rankAltostratus
Jan 07, 2022

iRule to set tcp timeout value for the specific URL

Hello Team,

We have a requirement to set up an iRule to set the TCP timeout of 600 sec for a particular URL passing via F5 VIP. I took some help from the F5 Dev articles, here is the complete iRule -

 

when HTTP_REQUEST {

if { ([HTTP::host] equals "example.com") } {

  IP::idle_timeout 600

set serverside_idle_timeout 1

 } 

}

 

when SERVER_CONNECTED {

 

if {$serverside_idle_timeout} {

 

IP::idle_timeout 600

 }

}

 

is this correct? Could someone tell explain why we need "set serverside_idle_timeout 1"

  • Hi  To expand on Daniel's reply, the example iRule in the Clouddocs site includes some more logic to help weed out edge cases, and to answer your question about "why we need "set serverside_idle_timeout 1"", that is because the details from HTTP::host don't exist inside of the SERVER_CONNECTED event without being transferred through a variable.

    • Daniel_Wolf's avatar
      Daniel_Wolf
      Icon for MVP rankMVP

      Erm, yes. I actually skipped to answer the question of "why". Thanks for closing this gap.

      • Nik2607's avatar
        Nik2607
        Icon for Altostratus rankAltostratus

        Hello Experts,

        The given iRule did not work and caused service interruptions. I have changed the syntax as below that resolved the issue - 

        serverside_idle_timeout 1 replaced with update_serverside_idle_timeout 1

        {$serverside_idle_timeout} replaced with {[info exists update_serverside_idle_timeout] && $update_serverside_idle_timeout}

        can someone explain me please what is the exact difference in the old and new syntax?

    • Nik2607's avatar
      Nik2607
      Icon for Altostratus rankAltostratus

      Hello Experts,

      The given iRule did not work and caused service interruptions. I have changed the syntax as below that resolved the issue - 

      serverside_idle_timeout 1 replaced with update_serverside_idle_timeout 1

      {$serverside_idle_timeout} replaced with {[info exists update_serverside_idle_timeout] && $update_serverside_idle_timeout}

      can someone explain me please what is the exact difference in the old and new syntax?