I need geoblock few countries and ASes, but for obvious reason I can’t use Varnish for this task as with my other sites. This solves that headache, if it is still operational.
Thanks for developing this useful plugin, Richard.
I made some minor modifications to adapt to my use case: blocking certain URLs for users in certain regions. What I’ve done is, in add_model_callback(:application_controller, :before_action), adding some more match rules with request.fullpath, e.g.:
I find that this URL-level geo-blocking works if I access the URL by directly typing it in the browser navigation bar. However, if I navigate to the URL by clicking it from Discourse homepage, this doesn’t work. (but after pressing F5 to refresh the page, it gets blocked.)
Could you give me any advice to fix this issue? Thanks.
You would need to add some Ember code that intercepts the router as well.
However, I think that you would need to take a different approach here. This plugin was not built for such specific filtering.
It would probably work way better to create a separate plugin that has a mechanism to add/remove users to groups based on their geolocation, and then you could leverage the existing group security to restrict or allow access to specific parts of the forum.
Ok thanks for that pointer. I was not factoring in exit nodes and I have no idea where the exit nodes where on the connections, the whats my ip read out was good enough for me, it matched the region/country that was being test geo blocked.
So flip it, I have blocked the zone of the zone I am located in and not used a VPN, use a different device one where I can test both fixed and cellular network, and still nothing happens, no geo block kicks in as expected when dialling in.
Please understand that a proxy, VPN or Tor will always be able to circumvent these kind of mechanisms. The plugin is not supposed to block those. Geo blocking is done either for legal reasons, or to block access for a casual visitor.