Forum Discussion

Mack_Hanson_107's avatar
Mack_Hanson_107
Icon for Nimbostratus rankNimbostratus
Nov 09, 2005

Set multiple cookies in a 302 response

Currently I've got a rule that works for setting one cookie via "HTTP::respond 302". How would I add two or more in the same redirect? I can do it in java, but would rather do it at the BigIP. Here's the rule I have that adds a single cookie.


when HTTP_REQUEST {
    set ckname "appID"
    set ckvalue "45893"
    set cookie [format "%s=%s; path=/; domain=%s" $ckname $ckvalue ".myco.org"]
    HTTP::respond 302 Location "http://www.myco.org" "Set-Cookie" $cookie
}
  • drteeth_127330's avatar
    drteeth_127330
    Historic F5 Account
    Multiple cookies can be specified in the same Set-Cookie header. So, all you have to do is append another cookie to the $cookie string separated by a semicolon.