porech / caddy-maxmind-geolocation

Caddy v2 module to filter requests based on source IP geolocation
91 stars 14 forks source link

http.log.error dial tcp: lookup @mygeofilter #19

Closed AdamWHY2K closed 11 months ago

AdamWHY2K commented 11 months ago

When connecting to my domain I either get a white screen, a 502 error, or elements of the expected page ( like it started loading and failed after only downloading the background or something ). The error in the title was displayed in the terminal after running caddy run and attempting to connect to the site.

Here's my Caddyfile

example.com {
        @mygeofilter {
                not maxmind_geolocation {
                        db_path "/etc/caddy/GeoLite2/GeoLite2-Country.mmdb"
                        allow_countries GB
                }
        }
        respond @mygeofilter 403
        reverse_proxy @mygeofilter localhost:5001
}

if I remove @mygeofilter from the last line the page loads as expected.

AdamWHY2K commented 11 months ago

I rewrote it in the style used in #14. Using (geofilter) and import geofilter, it's working fineish now—still slightly slower than before but usable—I don't understand why this change works but I'll take it I suppose.