Set cookie according to user agent


I have a request to set samesite for cookies only if the user agent version is different than some versions of chrome that does not support this option.

I know I have to capture the user-agent and somehow to use that in some acl but have no idea how do get to that. I was trying to look for some information out there but did not find anything relevant.

Is there anyone around here that can point me to the right direction?

You can capture the user-agent on logs with something like:

capture request header user-agent len 30

And do whatever, like blocking, with an acl, as this example:

http-request deny if { hdr_sub(User-Agent) -f /path/to/user-agent.list }