Caddy-maxmind-geolocation installed but still gives error "unknown module: http.matchers.maxmind_geolocation"

1. The problem I’m having:

I’ve been using caddy for a while in a fairly simple configuration and now I want to add different behavior depending on the visitor’s country. I added caddy-maxmind-geolocation module, and caddy list-modules confirms that it’s installed. Nevertheless when I try to do caddy reload I get the following error (see below).

2. Error messages and/or full log output:

HTTP 400: {“error”:“loading config: loading new config: loading http app module: provision http: server srv0: setting up route handlers: route 2: loading handler modules: position 0: loading module ‘subroute’: provision http.handlers.subroute: setting up subroutes: route 0: loading matcher modules: module name ‘maxmind_geolocation’: unknown module: http.matchers.maxmind_geolocation”}

3. Caddy version:

v2.10.2 h1:g/gTYjGMD0dec+UgMw8SnfmJ3I9+M2TdvoRL/Ovu6U8=

4. How I installed and ran Caddy:

I don’t remember, sorry, but it works)

a. System environment:

Linux 185-182-111-167.cloudvps.regruhosting.ru 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

b. Command:

caddy reload

c. Service/unit/compose file:


d. My complete Caddy config:

{
	auto_https disable_redirects
}

art-nouveau.ru {
	@russia {
		maxmind_geolocation {
			db_path "/etc/caddy/GeoLite2-Country.mmdb"
			allow_countries RU
		}
	}
	@notrussia {
		maxmind_geolocation {
			db_path "/etc/caddy/GeoLite2-Country.mmdb"
			deny_countries RU
		}
	}
	reverse_proxy @russia 192.248.xxx.xxx
	redir @notrussia https://art.nouveau.world{uri}
}

5. Links to relevant resources:

Could you please run the following and share the result?

caddy list-modules | grep maxmind

I just ran Caddy with the porech/caddy-maxmind-geolocation module, and your Caddyfile launches without any problems.

The only changes I made were using tls internal (since I obviously don’t own your domain) and adjusting the MMDB file path to match my local setup.

Here’s what I got:

$ caddy list-modules | grep maxmind
http.matchers.maxmind_geolocation

$ caddy -v
v2.10.2 h1:g/gTYjGMD0dec+UgMw8SnfmJ3I9+M2TdvoRL/Ovu6U8=

$ caddy validate --config test.tmp.Caddyfile
2025/12/20 00:05:50.552	INFO	using config from file	{"file": "test.tmp.Caddyfile"}
2025/12/20 00:05:50.555	INFO	adapted config to JSON	{"adapter": "caddyfile"}
2025/12/20 00:05:50.557	INFO	tls.cache.maintenance	started background certificate maintenance	{"cache": "0x1400017b500"}
2025/12/20 00:05:50.559	INFO	http.auto_https	server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS	{"server_name": "srv0", "https_port": 443}
2025/12/20 00:05:50.559	INFO	http.auto_https	automatic HTTP->HTTPS redirects are disabled	{"server_name": "srv0"}
2025/12/20 00:05:50.562	INFO	http	servers shutting down with eternal grace period
2025/12/20 00:05:50.562	INFO	tls.cache.maintenance	stopped background certificate maintenance	{"cache": "0x1400017b500"}
Valid configuration

$ caddy run --config test.tmp.Caddyfile
2025/12/20 00:09:34.045	INFO	maxprocs: Leaving GOMAXPROCS=10: CPU quota undefined
2025/12/20 00:09:34.046	INFO	GOMEMLIMIT is updated	{"package": "github.com/KimMachineGun/automemlimit/memlimit", "GOMEMLIMIT": 15461882265, "previous": 9223372036854775807}
2025/12/20 00:09:34.047	INFO	using config from file	{"file": "test.tmp.Caddyfile"}
2025/12/20 00:09:34.049	INFO	adapted config to JSON	{"adapter": "caddyfile"}
2025/12/20 00:09:34.053	INFO	admin	admin endpoint started	{"address": "localhost:2019", "enforce_origin": false, "origins": ["//localhost:2019", "//[::1]:2019", "//127.0.0.1:2019"]}
2025/12/20 00:09:34.054	INFO	tls.cache.maintenance	started background certificate maintenance	{"cache": "0x140000f9980"}
2025/12/20 00:09:34.056	INFO	http.auto_https	server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS	{"server_name": "srv0", "https_port": 443}
2025/12/20 00:09:34.056	INFO	http.auto_https	automatic HTTP->HTTPS redirects are disabled	{"server_name": "srv0"}
2025/12/20 00:09:34.059	INFO	pki.ca.local	root certificate is already trusted by system	{"path": "storage:pki/authorities/local/root.crt"}
2025/12/20 00:09:34.060	INFO	http	enabling HTTP/3 listener	{"addr": ":443"}
2025/12/20 00:09:34.062	INFO	http.log	server running	{"name": "srv0", "protocols": ["h1", "h2", "h3"]}
2025/12/20 00:09:34.063	INFO	http	enabling automatic TLS certificate management	{"domains": ["art-nouveau.ru"]}
2025/12/20 00:09:34.064	WARN	tls	stapling OCSP	{"identifiers": ["art-nouveau.ru"]}
2025/12/20 00:09:34.065	INFO	autosaved config (load with --resume flag)	{"file": "REDACTED/Caddy/autosave.json"}
2025/12/20 00:09:34.065	INFO	serving initial configuration
2025/12/20 00:09:34.073	INFO	tls	storage cleaning happened too recently; skipping for now	{"storage": "FileStorage:REDACTED/Caddy", "instance": "372e15ad-0e4a-481b-b299-c03720496eff", "try_again": "2025/12/21 00:09:34.073", "try_again_in": 86399.99999975}
2025/12/20 00:09:34.074	INFO	tls	finished cleaning storage units
$ curl https://art-nouveau.ru --resolve art-nouveau.ru:443:127.0.0.1 -I
HTTP/2 302
alt-svc: h3=":443"; ma=2592000
location: https://art.nouveau.world/
server: Caddy
date: Sat, 20 Dec 2025 00:19:34 GMT

I suspect there might be an issue with how Caddy or the module was built or installed on your end.

Thank you @timelordx for taking the time to look into the issue.

In the meantime I realized my stupid mistake: I should have explicitly stopped and started caddy process after I added the maxmind module to it. Apparently caddy reload does not restart/replace the executable, it just instructs the running process to reread the caddyfile but it’s still the old executable (without maxmind) running. So when I run caddy whatever from command line it’s the new executable that responds but the actual server is still running the old executable. Duh…

2 Likes