Jump to content
Welcome to our new Citrix community!

http_cookie_t question?

Ross Helfand

Recommended Posts



I'm trying to understand the 'EXISTS' section in the https_cookie_t advanced policy expression reference.


Essentially what I'm trying to do is write a responder policy to test if a certain cookie is present in the request.  I've tried playing around with the expression evaluator in the GUI, but I can't seem to make it work.  I've currently worked around the issue by using something like:


And using REGEX_MATCH with .NOT.  It works, it's just kind of ugly.  ?


Any help would be appreciated!

Link to comment
Share on other sites

Can you clarify what you would like to do?

Exists is just to determine whether the header is present or not regardless of value it contains.  True if present; false if not.  It can't evaluate easily if a specific cookie has been set (this is handled differently in the advanced engine.) Some examples below.


For a sample request:

Get /somepage.htm HTTP/1.1

Cookie: sessionid=100xyz;newcookie=newvalue


http.req.cookie.exists confirms whether a cookie header exists or not. So in this case it is TRUE (header is present); does not confirm if a specific cookie is present.


http.req.cookie.value("newcookie") returns cookie value for cookie named "newcookie" which is "newvalue".


However, attempt to retrieve a cookie that isn't present returns UNDEF.

Example:  http.req.cookie.value("notacookie") retruns UNDEF which  in a policy expression will generate the policies undefined result action, which may not be what you want.


However, http.req.cookie.contains("newcookie") will return TRUE if name is present OR FALSE if name is not present. 

So, if you want to see if a cookie is present before you act on it, then a better mechanism is to structure your policy expressions like:


You want a policy with an A && B structure.

http.req.cookie.contains("somecookie") && <then other expression>


If expression A is false, then it never attempts the expression B clause and will not evaluate as undefined.




Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...