How to block all referrer with a particular TLD?

Hi,
I would want to block all referrers that have a particular TLD, let’s say “.abc”. So, I would want to block the domain “spammy.abc”, but not “www.abcdomain.com”.

If I make a Cloudflare rule like:
(http.referer contains “.abc”) then block

Will the rule block referrer like “www.abcdomain.com” also or will it block only referrers that have TLD “.abc” ?

Yes, it will block more, also the example you provided. Your best bet might be

http.referer contains ".abc/"

However even this might block http://some.domain.com/a/random/.abc/path.jpg

Currently there is no clean solution to do this, unless you upgrade to a business plan in which case you can use regular expressions. An alternative might be Workers and custom code, however that could be pricey as you’d have to tunnel each request through them.

Thanks for the reply.