caddy-webdav: internal handler error (stat) spam by bad clients (macOS Finder & Windows Explorer)
My logs are filled with entries such as:
Sep 24 15:14:11 prod3ls.mega.corp caddy[774527]:
{
"level": "error",
"ts": 1727183651.6396859,
"logger": "http.handlers.webdav",
"msg": "internal handler error",
"error": "stat /var/www/propserver/._.: no such file or directory",
"request": {
"remote_ip": "172.28.35.122",
"remote_port": "50187",
"client_ip": "172.28.35.122",
"proto": "HTTP/1.1",
"method": "PROPFIND",
"host": "propserver.mega.corp",
"uri": "/._.",
"headers": {
"Authorization": [
"REDACTED"
],
"Content-Length": [
"179"
],
"Connection": [
"keep-alive"
],
"Content-Type": [
"text/xml"
],
"Depth": [
"0"
],
"Accept": [
"*/*"
],
"User-Agent": [
"WebDAVFS/3.0.0 (03008000) Darwin/23.6.0 (arm64)"
]
},
"tls": {
"resumed": false,
"version": 771,
"cipher_suite": 49199,
"proto": "",
"server_name": "propserver.mega.corp"
}
}
}
I know this is just the macOS Finder doing silly Finder things, but what bothers me so much is that this is dumped to the Journal on systemd machines (RedHat/CentOS/Fedora).
So while the virtualhost/server/access log shows a 404 being returned, the underlying stat /var/www/propserver/._.: no such file or directory doesn’t seem to be handled and gets dumped to the main Caddy process. This floods the logs which makes detecting actual issues much more difficult.
I have no control over my clients, so I see loads of these calls coming in from macOS Finder and Windows Explorer.
Is there some way to prevent these log messages from being output by the main Caddy process? I’d much rather have the errors contained in the actual logs as defined in the caddyfiles.
My /usr/lib/systemd/system/caddy.service:
[Unit]
Description=Caddy web server
Documentation=https://caddyserver.com/docs/
After=network.target
[Service]
Type=notify
User=caddy
Group=caddy
ExecStartPre=/usr/bin/caddy validate --config /etc/caddy/Caddyfile
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectHome=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
My /etc/caddy/Caddyfile.d/propserver.caddyfile
propserver.mega.corp:80 {
redir https://{host}{uri} permanent
}
propserver.mega.corp {
root * /var/www/propserver
tls /etc/pki/tls/certs/propserver.mega.corp.chain.pem /etc/pki/tls/private/propserver.mega.corp.key
encode gzip
log {
output file /var/log/caddy/propserver.log
level INFO
format console
}
handle_errors {
respond "{err.status_code} {err.status_text}"
}
@not-get not method GET HEAD
route @not-get {
request_body {
max_size 10KB
}
basic_auth {
propwriter $2b$12$UYc2rQAiHfHd/EBmiT/b4OLpCWtOIXt6cQCoS6snZ1ilcr8wuGXCC
}
webdav
}
file_server
}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (8 by maintainers)
Commits related to this issue
- Don't log does not exist errors Related to #47 — committed to wader/caddy-webdav by wader 2 years ago
- Don't log does not exist errors Related to #47 — committed to wader/caddy-webdav by wader 2 years ago
- Don't log does not exist errors Related to #47 — committed to wader/caddy-webdav by wader 2 years ago
- Don't log does not exist errors (#49) Related to #47 — committed to mholt/caddy-webdav by wader 2 years ago
- Log webdav request errors at debug level Related to #47 — committed to wader/caddy-webdav by wader 2 years ago
- Log webdav request errors at debug level (#51) Related to #47 — committed to mholt/caddy-webdav by wader 2 years ago
@mholt thanks for clarifying.
I’ve been able to test it and the systemd journal is indeed much quieter now. So that makes me happy 😃.
There’s still some stuff bleeding through such as:
But the spam is basically 90% less 👍
If it’s an error that WebDAV clients are used to receiving and then they simply retry or whatever, then sure, we probably can demote those to DEBUG-level.