User-Agent blocking not working

Hello!

I’m trying to block some web crawlers on my website, and to test I tried blocking my own browser (Opera GX). It doesn’t seem to be working, I waited some minutes and tried to acess my website, and I could access it normally. There’s no page rules disabling security or the firewall, as other firewall rules are working on that domain.
I specified to block the UA “OPR”, which is used for Opera GX browser. Did I do something wrong or is that feature not working?

May I ask did you use a User-agent field in a Firewall Rule or you added it under the User Agent Blocking option?

Opera GX has got many User-agents, see the list below:

Did you used only a part of the User-agent name or the full one?

Example:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36 OPR/60.0.3255.50747 OPRGX/60.0.3255.50747

Is:
Opera GX 60 on Windows 10

If you created a Firewall Rule and according to the upper link to provided Opera User-agent list, it should have a expression with contains “OPR” or " OPRGX" like on the screenshot below.

Remember, adding or modifying Firewall rules could take few minutes to apply changes.

1 Like

I actually tried both things: tried blocking as a Firewall rule and in the User Agent blocking option.

Just a part. As I mentioned, only OPR. My user agent contains “OPR”.

I was using a Firewall rule to block multiple user-agents with OR expressions, and it wasn’t working. This firewall rule exists more than a week, and I noticed that the user-agent stills accessing my website, as I could see in my site access logs.

For whatever reason the Firewall rule just started working, but I temporarily disabled the firewall rule and added a blocking rule to the “User-Agent blocking” option on the Tools area, and it didn’t block my browser.

This:

Lets me access the site normally.

This:


Blocks me from accessing the website.

I don’t know if the User-Agent blocking tool is broken, or if it requires a complete UA like OPR/60.0.3255.50747.

TL;DR the firewall rule is working now but the User-Agent blocking tool seems not to work, even with the same user agent.

1 Like

Yes, it should work as an example from my reply.

I believe it should have be the full User-agent, but nevertheless for Opera GX there are milions of examples, while on Cloudflare Free plan there is a limit of 10 rules as I remember so to block all of them it is more convinient way to use Firewall rule for that.

Which other user-agents would you like to block?
Can you share it here?

I believe we can fix and modify it so it should work as you want it :wink:

Yeah, that’s probably it. It’s kinda weird, because I would need to keep updating the User-Agent as the browser version changes. Looking at the support article of that tool it says that does not accepts wildcards, that’s probably the reason that it wasn’t working.

The rule is working as expected now. I added another UA to block in that same rule and it suddenly began working. I also disabled the rule and enabled it again, probably there was some visual issue that was showing it as enabled but the rule wasn’t being implemented on connections.

Thanks for your help!

1 Like

In Firewall rules, you can use Regular expressions, but this only work from Business plans and up.

https://developers.cloudflare.com/firewall/cf-firewall-rules/fields-and-expressions

I am happy to assist you and glad you found a solution :wink:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.