[feat] Log [nil] denied requests + detailed info on timeouts
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]
Hello @tannisroot
Yes, I think this would be helpful. I will add this to the next release.
@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
@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
There should be more output in the log file if a request is denied. Fixed in pull request 97