For those wanting to block the nasty crawlers in one go, including AI Training, a single CF expression for use.
Code:
(http.user_agent contains "meta-externalagent" or http.user_agent contains "ClaudeBot" or http.user_agent contains "Amazonbot" or http.user_agent contains "SemrushBot" or http.user_agent contains "DotBot" or http.user_agent contains "AhrefsBot" or http.user_agent contains "Bytespider" or http.user_agent contains "GPTBot" or http.user_agent contains "MJ12bot" or http.user_agent contains "AcademicBot" or http.user_agent contains "ExaSearchBot" or http.user_agent contains "ShapBot" or http.user_agent contains "PetalBot" or http.user_agent contains "meta-webindexer" or http.user_agent contains "ReflectionBot" or http.user_agent contains "yacybot" or http.user_agent contains "LinkupBot" or http.user_agent contains "compatible; crawler)" or http.user_agent contains "Scrapy" or http.user_agent contains "Sogou" or http.user_agent contains "Qwantbot" or http.user_agent contains "Barkrowler" or http.user_agent contains "curl" or http.user_agent contains "ClueWeb-Crawler" or http.user_agent contains "Turnitin" or http.user_agent contains "MathPicDatasetCrawler" or http.user_agent contains "PurityBot" or http.user_agent contains "img2dataset" or http.user_agent contains "quillbot" or http.user_agent contains "IbouBot" or http.user_agent contains "Go-http-client" or http.user_agent contains "Brightbot" or http.user_agent contains "Mediatoolkitbot" or http.user_agent contains "webzio" or http.user_agent contains "YisouSpider" or http.user_agent contains "AwarioBot" or http.user_agent contains "CCBot" or http.user_agent contains "okhttp" or http.user_agent contains "serpstat" or http.user_agent contains "DataForSeo" or http.user_agent contains "Google-Extended" or http.user_agent contains "Timpibot" or http.user_agent contains "cohere-ai" or http.user_agent contains "anthropic-ai" or http.user_agent contains "ZoominfoBot" or http.user_agent contains "Applebot-Extended" or http.user_agent contains "Diffbot" or http.user_agent contains "ImagesiftBot" or http.user_agent contains "FacebookBot" or http.user_agent contains "omgili" or http.user_agent contains "BLEXBot" or http.user_agent contains "W3C_Validator") and (not cf.client.bot) and (not http.cookie contains "xf_user")
It will target: meta-externalagent, ClaudeBot, Amazonbot, SemrushBot, DotBot, AhrefsBot, Bytespider, GPTBot, MJ12bot, AcademicBot, ExaSearchBot, ShapBot, PetalBot, meta-webindexer, ReflectionBot, yacybot, LinkupBot, generic “compatible; crawler” user agents, Scrapy, Sogou, Qwantbot, Barkrowler, curl, ClueWeb-Crawler, Turnitin, MathPicDatasetCrawler, PurityBot, img2dataset, quillbot, IbouBot, Go-http-client, Brightbot, Mediatoolkitbot, webzio, YisouSpider, AwarioBot, CCBot, okhttp, serpstat, DataForSeo, Google-Extended, Timpibot, cohere-ai, anthropic-ai, ZoominfoBot, Applebot-Extended, Diffbot, ImagesiftBot, FacebookBot, omgili, BLEXBot and W3C_Validator.