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.