caddy-maxmind-geolocation icon indicating copy to clipboard operation
caddy-maxmind-geolocation copied to clipboard

Allow ip from local LAN

Open 9acca9 opened this issue 1 year ago • 1 comments

Hi. Im using this kind of config in my Caddyfile:

test.example.org {
  @mygeofilter {
    maxmind_geolocation {
      db_path "/usr/share/GeoIP/GeoLite2-Country.mmdb"
      allow_countries IT FR
    }
  }

   file_server @mygeofilter {
     root /var/www/html
   }
}

And all is working fine except that i cant reach my webs from y local LAN. in my PC i have this to point from inside my network /etc/hosts 192.168.0.3 trilium.xxxxxxx.xyz

(192.168.0.3 is caddy) What can i do? Thanks

9acca9 avatar Apr 29 '24 00:04 9acca9

I assume that your Caddy instance is running on your LAN. In that case, I would rather suggest you remove that entry from your hosts file and enter the FQDN to access your website. That is because you will probably have set up automatic HTTPS and I don't think you have added your local LAN IP address into your website's certificate's SAN (domain names that the certificate can authenticate). Therefore, that might be one of the reasons your website is currently not working.

zallaevan avatar May 16 '24 22:05 zallaevan

you can either use "allow_countries UNK IT FR" so it will allow IP from unknown countries, including LAN IP or use deny_countries XX XY YY to block countries

azertylr avatar Aug 06 '24 19:08 azertylr

There is a way to do this using Caddy syntax, detailed here: https://github.com/porech/caddy-maxmind-geolocation/issues/11

dJani97 avatar Sep 30 '24 14:09 dJani97