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

cgallimore_1748's avatar
cgallimore_1748
Icon for Nimbostratus rankNimbostratus
Jul 28, 2016

Setting a cookie

I am trying to set a cookie on the client machine for it to pass on to the server. How would I go about doing this? My cookie knowledge is very limited. Currently I am trying to set it via the code below and am not seeing it get set in a Fiddler capture on the client or seeing the desired results from the server side.

 

when HTTP_RESPONSE { HTTP::cookie insert name "CookieName" value "CookieValue" }

 

Thanks for any help

 

2 Replies

  • If you are looking for cookie persistence, I would recommend using the default cookie persistence available in F5 LTM.

     

    See this for cookie insertion via iRule.

     

  • Hi,

     

    You can insert a cookie by using a code similar to the one below in an irule that you bind to your Virtual Server :

     

    when HTTP_REQUEST {
            set host [HTTP::host]
    }
    when HTTP_RESPONSE {
      HTTP::cookie insert name CookieName value CookieValue domain $host
    }