Geo Blocking plugin

What could we guess… 98% of those are bots :winking_face_with_tongue: To show or not to show a message… it depends. If there is need to guide geoip-blocked real humans to use VPN, then showing the reason is smart move. Waste of time with bots, though.

1 Like

The plugin was originally made to enforce economic sanctions against specific countries.

2 Likes

This gives now error 500. It goes nicely thru rebuilding, though.

Is it fixable, please?

Otherwise I have to install Nginx to act as a reverse proxy, and then I would be too afraid to ask any support here ever :joy:

Fixed

@juanjosegzl guess your LLM was too enthousiastic and we both didn’t test your PR well enough

1 Like

Sorry I did not catch that, I was too focused on my own use case

1 Like

Sorry, there is still issues.

I have reverted the most recent PR to the plugin and I will reconsider it in a few weeks when I have time. Sorry all for the inconvenience.

2 Likes

S…uch happens. But that plugin is really needed. Thanks for your efforts.

1 Like

Sorry for all the problems, I re visited the changes and I found an issue with moderating, now I have fixed it

Richard I pushed the changes, basically fixing the moderating issue and disable cache when moderating settings are changed.

2 Likes

Thank you!
I am currently traveling and I will revisit the PR in 10 days from now.

It works for me. Geoblocking itself I haven’t tested yet.

Well, my anonymous user got too fast typing, what is funny becuse I’m on iPad with virtual keyboard :joy: but that has nothing to do with this plugin.

Thanks.

2 Likes

@juanjosegzl I have now merged your latest PR. Thank you for your useful contribution!

1 Like

Does this work if you are using cloudflare?

Cloudflare transmits the IP address in the CF-IPCountry header variable.

Yes it works if you follow the guide Using Discourse with Cloudflare: Best Practices

This is incorrect. Cloudflare transmits the country code in that header, not the IP address, and only if you’ve enabled it. The plugin does not use that though, it uses the internal Discourse Maxmind database.

Hello, the plugin is great. I have a small request: Can we add a configuration to customize the prompt messages?

Oh, I see. The /admin/customize/site_texts website text feature can be used, so no additional configuration is needed.

1 Like

Hi, I’d like to know how to configure access for specific IPs within restricted regions.

I’ve created a pull request:
add ip whitelist by singi2016cn · Pull Request #8 · communiteq/discourse-geo-blocking

1 Like

Thank you for that PR. I have responded to it. The functional enhancement is very welcome but not at the expense of making an extra database call for every single request. If you move the code inside the lazy loaded cache block then we can accept it.

2 Likes

Okay, I’ve identified the issue. I’ll resubmit the merge request after making the changes. Please take another look.

1 Like

Hello everyone, I have a new requirement.
I now want to allow access only from specific countries while blocking access from the vast majority of others. Would this require adding a configuration similar to geo_blocking_country_region_allowlist? When this configuration is present, the system should check whether the user is within the specified range; if so, grant access, otherwise block.
When both geo_blocking_country_region_blocklist and geo_blocking_country_region_allowlist are configured, only geo_blocking_country_region_allowlist should be evaluated. If it is not configured, then geo_blocking_country_region_blocklist should be evaluated.

PR welcome if you do the following to make it backwards compatible with the current functionality:

Add an extra setting “block all except allowlist” and only when that setting is enabled it will behave like you describe.