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

Snl's avatar
Snl
Icon for Cirrostratus rankCirrostratus
Oct 24, 2018

Irule help

Folks

i am looking irule which help me on below requirement

TCP/HTTP session has to be gracefully closed when we get response from server as 204

is below irule can help

when HTTP_RESPONSE_RELEASE {
      if { [HTTP::status] == 204 }{

         log local0. "HTTP close" 
    HTTP::close 
     log local0. "TCP close" 
    TCP::close 
 }
    }

1 Reply

  • I wouldn't close the HTTP session in the event

    HTTP_RESPONSE_RELEASE
    as the HTTP response is about to be released from the F5 to the client but I would use the
    HTTP_RESPONSE
    event.

    If you need to ensure it is the last

    HTTP_RESPONSE
    event then you can add a priority of 900 e.g.
    when HTTP_RESPONSE priority 900 {

    I do not think you need to close the TCP session else you will not send a response to the client at all and the command

    HTTP::close
    should close the connection after sending the response with the inserted header Connection: Close.

    when HTTP_RESPONSE {
        if {[HTTP::status] == 204}{
            log local0. "HTTP close" 
            HTTP::close 
        }
    }
    

    Finally HTTP is stateless so even if the browser closes the TCP connection down following the response header Connection: Close being received it will likely just open a new one if it has another request to send. So this is removing the use of Connection: keep-alive from the client.