Need help Whitelisting specific URL's from a CF blocked countries

workers

#1

We have a website (www.example.com) that needs to block EU countries due to GDPR non-compliance. This will be temporary until we can put in a fix, but while blocking countries currently in the EU how can we allow certain URL’s to bypass this block (www.example.com/Business*)? Apologies if this was covered in a previous thread.


#2

Hi @barry.hartwell, I searched the Community for “allow certain URL’s to bypass this block” and found this thread “Block all traffic, allow certain IPs”, Block all traffic, allow certain IPs


#3

Probably the best way to do this type of more complex logic would be to use Cloudflare Workers.


#4

Thanks @cloonan, this might be possible however we have page rules in effect which redirect that /Business traffic to a separate AWS cloud environment so I don’t know if allowing certain IPs will work in our scenario, but I will research it further. Thank you for your suggestion.


#5

Thank you @scharff, this method was also suggested to me in the past from our Enterprise support team that CF Workers may be the way to go, but I couldn’t find any examples of how to set up a worker to accomplish my goal. Any insights on how to set this up would be greatly appreciated. From what I understand it requires some javascript knowledge, which is outside my wheelhouse at the moment. Thank you for confirming the cf worker solution. I appreciate any examples you could provide.


#6

If you have an Enterprise account here it would be way better asking them directly for help. It will be surely better and more specific.


#7

Check out this discussion with an example of how to redirect based on GeoIP/country location. It obviously isn’t quite the same but it might be a reasonable starting point.


#8

I tried, this was the response i received from Enterprise Support:

"I can see that Workers are enabled on your domain. As to writing the worker, you will have to do that on your end but we will be happy to help you troubleshoot if you run into issues.

Please let us know if you have any further questions or issues by replying to this e-mail or ticket."

The problem is i have no idea where to start. I did recently (today) speak with my Enterprise technical account rep and he told me there is a new feature coming soon to CF that will possibly address this problem. I can follow up with this thread once i get a definitive solution. Thank you all for chiming in, I appreciate the quick responses and all advice given.


#9

I wrote a small service worker example that does what you are trying to achieve.