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 9 months ago • 3 comments
trafficstars

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