1. The problem I’m having:
Somehow I am able to see admin metrics, runtime metics, reverse proxy metrics but not the middleware metrics. Until a few days ago the metrics were displayed just fine. I don´t know, what could have changed, except maybe for restarting caddy. I am calling the endpoint via http://localhost:2020/metrics. Any idea?
3. Caddy version:
v2.6.2
4. How I installed and ran Caddy:
a. System environment:
Debian 11 5.10.0-21-amd64
c. Service/unit/compose file:
;
; Ansible managed
;
; source: https://github.com/mholt/caddy/blob/master/dist/init/linux-systemd/caddy.service
; version: 6be0386
; changes: Set variables via Ansible
[Unit]
Description=Caddy HTTP/2 web server
Documentation=https://caddyserver.com/docs
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service
StartLimitIntervalSec=86400
StartLimitBurst=5
[Service]
Restart=on-failure
; User and group the process will run as.
User=www-data
Group=www-data
; Letsencrypt-issued certificates will be written to this directory.
Environment=CADDYPATH=/etc/ssl/caddy
ExecStart="/usr/local/bin/caddy" run --environ --config "/etc/caddy/config.json"
ExecReload="/usr/local/bin/caddy" reload --config "/etc/caddy/config.json"
; Limit the number of file descriptors; see `man systemd.exec` for more limit settings.
LimitNOFILE=1048576
; Use private /tmp and /var/tmp, which are discarded after caddy stops.
PrivateTmp=true
; Use a minimal /dev
PrivateDevices=true
; Hide /home, /root, and /run/user. Nobody will steal your SSH-keys.
ProtectHome=false
; Make /usr, /boot, /etc and possibly some more folders read-only.
ProtectSystem=full
; … except /etc/ssl/caddy, because we want Letsencrypt-certificates there.
; This merely retains r/w access rights, it does not add any new. Must still be writable on the host!
ReadWriteDirectories=/etc/ssl/caddy /var/log/caddy
; The following additional security directives only work with systemd v229 or later.
; They further retrict privileges that can be gained by caddy.
; Note that you may have to add capabilities required by any plugins in use.
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target
d. My complete Caddy config:
{
"apps": {
"http": {
"servers": {
"metrics": {
"listen":[":2020"],
"routes":[
{
"handle":[
{
"handler":"metrics"
}
]
}
]
},
"apps": {...}
}
}
}
}