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

mnb_63148's avatar
mnb_63148
Icon for Nimbostratus rankNimbostratus
Feb 20, 2014

Does F5 automatically delete cookies in the header?

I have an issue where cookies are not always showing in the HTTP header. This is causing session timeouts when users are trying to log into a site and when they are randomly clicking around in a site. Does F5 delete cookies if the header is too large?

 

12 Replies

  • Did you check if this behavior is for specific browsers?

     

    Depending on the version of browser there is a limitation on cookie size for Safari and number of cookies for Mozilla. I dont have exact numbers we faced this issue with large number of cookies with older versions of browsers.

     

    F5 Does not strip out, you can log cookies to find out if its being received by F5.

     

  • In v10 at least, the HTTP profile has a "Maximum Header Size" property. Mine, which I believe is the default, is set to 32768 (32Kb). In situations where I've encountered this, there's a entry written to /var/log/ltm and the TCP connection is reset.

     

    But resetting the TCP connection is much different than stripping out a header and load-balancing the request. I believe you can cause the LTM to strip out headers based on some of the HTTP profile properties, and you can certainly do it with an iRule. But I don't believe there's any inherent/default LTM behavior that would cause it to strip out a header.

     

  • looks like we are seeing the issue when our httpOnly iRule is below our http_cookie_secure_irule.

     

    httponly_irule

     

    when HTTP_RESPONSE { set ck [HTTP::header values "Set-Cookie"] HTTP::header remove "Set-Cookie"

     

    foreach acookie $ck { HTTP::header insert "Set-Cookie" "${acookie}; HttpOnly" }

     

    http_cookie_secure_irule

     

    }

     

    • mnb_63148's avatar
      mnb_63148
      Icon for Nimbostratus rankNimbostratus
      Reversing the iRule order for httpOnly and secure cookies worked for a few hours and a user experienced a session timeout again. We are seeing in the packet capture that one of the cookies needed is getting removed by Big-IP when it is being passed to the server.
  • To support the others on this thread, unless you have configured cookie removal via an iRule or profile, then the F5 will not remove any cookies. Are you sure the cookie is not being transmitted by the browser because the request is over HTTP (not HTTPS) and the Secure attribute is set?

     

  • We are seeing in the packet capture that one of the cookies needed is getting removed by Big-IP when it is being passed to the server.

     

    are you seeing client sends cookie to bigip but it is removed when sending to server?

     

    can you post irule containing HTTP_REQUEST event or http profile which may remove the cookie?

     

    • mnb_63148's avatar
      mnb_63148
      Icon for Nimbostratus rankNimbostratus
      Below are the iRules that reference cookies: iRule 1 when HTTP_RESPONSE { set myValues [HTTP::cookie names] foreach mycookies $myValues { HTTP::cookie secure $mycookies enable } } iRule 2 when HTTP_RESPONSE { set ck [HTTP::header values "Set-Cookie"] HTTP::header remove "Set-Cookie" foreach acookie $ck { HTTP::header insert "Set-Cookie" "${acookie}; HttpOnly" } }
  • We are seeing in the packet capture that one of the cookies needed is getting removed by Big-IP when it is being passed to the server.

     

    are you seeing client sends cookie to bigip but it is removed when sending to server?

     

    can you post irule containing HTTP_REQUEST event or http profile which may remove the cookie?

     

    • mnb_63148's avatar
      mnb_63148
      Icon for Nimbostratus rankNimbostratus
      Below are the iRules that reference cookies: iRule 1 when HTTP_RESPONSE { set myValues [HTTP::cookie names] foreach mycookies $myValues { HTTP::cookie secure $mycookies enable } } iRule 2 when HTTP_RESPONSE { set ck [HTTP::header values "Set-Cookie"] HTTP::header remove "Set-Cookie" foreach acookie $ck { HTTP::header insert "Set-Cookie" "${acookie}; HttpOnly" } }
  • Hi can you try adding the following clauses in to help see where it is going missing?;

    when HTTP_REQUEST {
    set prefix "\[[expr {int (rand() * 10000)}]\] " 
        log local0. "${prefix}Request [HTTP::uri] cookies [HTTP::cookie names]"
    }
    when HTTP_REQUEST_SEND {
         log local0. "${prefix}Request [HTTP::uri] cookies [HTTP::cookie names]"
    }
    

    Then you can keep track of the request as it comes into the F5 and as it is about to leave.

    • mnb_63148's avatar
      mnb_63148
      Icon for Nimbostratus rankNimbostratus
      Thanks, IhearF5. I will run the command when we test again. Looking at a previous capture, I see that in the HTTP RESPONSE from the pool member to the F5, the server is returning 3 cookies. However, in the response from the virtual server to the pool member, two of the cookies are not there.
  • Right - so it's the responses where you are losing cookies? It's gotta be the iRule doing it and 2 is prime suspect but I'm scratching my head to see exactly what is wrong. Add these extra statements in;-

    when HTTP_RESPONSE {
        set ck [HTTP::header values "Set-Cookie"]
        log local0. $ck
        log local0.[HTTP::cookie names]
        HTTP::header remove "Set-Cookie"
        foreach acookie $ck {
            log local0. "Cookie $acookie"
            HTTP::header insert "Set-Cookie" "${acookie}; HttpOnly"
        }
    }