Forum Discussion

atoth's avatar
atoth
Icon for Cirrus rankCirrus
Mar 27, 2017

Could someone explain how to create a cookie via irule?

I've got a pre-existing irule that checks whether the value of an individual cookie equals a given value, and then sends it on to a particular server. So I've got this line I'd like to put earlier in the rule.

 

http::cookie insert  value targetCookie "" path / domain ".abc.com"

 

The latter line, which was already existing is as follows.

 

elseif {([http::cookie value "targetCookie" ] equals "" ) } { node  }

 

This seems simple enough, but I'm scratching my head as to the relationship between "targetCookie" and its value and whether I got the syntax correct.

I'd also like to know whether for the domain parameter, does ".abc.com" need quotes or not.

1 Reply

  • It looks to me you are confusing the cookie Name with a cookie Value. Your pre-existing line of code checks if a cookie with a Name "targetCookie" has Value "" and if yes then send the traffic to the backend node (server) with specific IP address.

    The line you are trying to wrong because the cookie name should be "targetCookie" and value should be the server name.

    You should be putting all string parameters in double quotes.

    HTTP::cookie command documentation is available here:

    https://clouddocs.f5.com/api/irules/HTTP__cookie.html