geoblock icon indicating copy to clipboard operation
geoblock copied to clipboard

[feat] Log [nil] denied requests + detailed info on timeouts

Open tannisroot opened this issue 1 year ago • 3 comments

It would help a lot to diagnose issues with this plugin. Example where it would help: I was having an issue where sometimes the plugin would randomly block requests from countries that were whitelisted. Turns out, API responses to geojs for me are for some reason ridiculously slow and would often hit the default API timeout of 750. There would be nothing about this in the log file I've specified, and in docker logs for traefik container, there would just be a message about the IP being blocked without listing why or the country code of the IP (because it would fallback to nil value), and I assumed lines like INFO: GeoBlock: 2025/01/30 10:15:15 API timeout: 750 were just indicating the settings for the plugin, not that the API timeout is being hit.

What the option to log denied requests could look like:

Failed to fetch country for ip IP_ADDRESS from https://get.geojs.io/v1/ip/country/IP_ADDRESS, hit timeout=750, setting to [nil]
geoblock@file: request denied [ IP_ADDRESS] for country [nil]

tannisroot avatar Jan 30 '25 11:01 tannisroot

Hello @tannisroot

Yes, I think this would be helpful. I will add this to the next release.

PascalMinder avatar Jan 31 '25 05:01 PascalMinder

@PascalMinder I am curious how you feel about also logging the exact URL the request came to. My use case is that I see some requests being denied because they are coming from banned countries. But, I want to know which subdomain they are trying to hit.

PS: if there's another way to check this, that would work too

varunsudarshan avatar Feb 24 '25 00:02 varunsudarshan

@PascalMinder I am curious how you feel about also logging the exact URL the request came to. My use case is that I see some requests being denied because they are coming from banned countries. But, I want to know which subdomain they are trying to hit.

PS: if there's another way to check this, that would work too

You can learn this from Traefik's access.log, it shouldn't be hard to match those logs from geoblock's

tannisroot avatar Feb 24 '25 03:02 tannisroot

There should be more output in the log file if a request is denied. Fixed in pull request 97

PascalMinder avatar Oct 19 '25 19:10 PascalMinder