I’m trying to access the /metrics endpoint, but the connection is refused.
curl -v http://localhost:2019/metrics
Host localhost:2019 was resolved.
IPv6: ::1
IPv4: 127.0.0.1
Trying [::1]:2019…
connect to ::1 port 2019 from ::1 port 52196 failed: Connection refused
Trying 127.0.0.1:2019…
Established connection to localhost (127.0.0.1 port 2019) from 127.0.0.1 port 60996
using HTTP/1.x
GET /metrics HTTP/1.1
Host: localhost:2019
User-Agent: curl/8.18.0
Accept: /
Request completely sent off
< HTTP/1.1 403 Forbidden
< Content-Type: application/json
< Date: Sun, 22 Mar 2026 11:03:08 GMT
< Content-Length: 45
<
{“error”:“host not allowed: localhost:2019”}
Connection #0 to host localhost:2019 left intact
2. Error messages and/or full log output:
mrt 22 12:04:15 nixos caddy[8004]: {“level”:“error”,“ts”:1774177455.8594854,“logger”:“admin.api”,“msg”:“request error”,“error”:“host not allowed: localhost:2019”,“status_code”:403}
I’m not sure what “didn’t have the Caddy CLI installed” means, because Caddy is a command. You’re using Nix, which is deterministic when it comes to versioning. It’s likely using the caddy reload command to reload config. Double check the deployed version.