Cf.client.bot not available

Hi All,
I saw that Cloudflare is providing the option to identify bots

but when I’m trying to access this object in the worker (request.cf.client.bot) it is not available.
actually even request.cf.client isn’t available.

btw,
I have created the role in “Firewall Rules” that allows the bots traffic through my worker.

thanks!

Hi @dan19,

The linked documentation is for Firewall Rules, not Workers. cf.client.bot can be part of a Firewall Rule expression, but that is separate from the Workers concept of request attributes. The list of request attributes we currently support is here: Request · Cloudflare Workers docs

Harris

1 Like

Hi Harris,
Thanks for the quick response.
Is there any way I can identify bots through Cloudflare workers?
maybe a built-in feature?

2 Likes

Realize it’s a little old, though came here because I was looking at how to identify bot requests from a Worker or Page as well as I understand that CF has some information about at least the potentiality, right?

For anyone else who stumbles across this thread, you can add cf.client.bot to a request header using Transform Rules and simply read that in your Worker.