First, my public IP and FQDN are all redacted for security reasons and both are not the problem.
I use a banking software (Banking4i) that backup it’s data file to my WebDAV (SFTPgo) server. Caddy is used as a Reverse Proxy. Everything is a common dockerized setup:
Client Software (iOS or macOS) → Caddy Reverse Proxy (TLS) (Docker) → WebDAV Server (no TLS) (Docker)
- Caddy v2.5.2 and earlier work as expected.
- Caddy v2.6.0-beta.3 crashes Caddy
- Caddy v2.6.0-beta.5 and later breaks WebDAV client to finish uploading
I use an own Caddy Docker image with some modules, but behavior is the same with your pure Caddy Docker image from hub.docker.com
Debug output of Caddy 2.5.2:
{
"level": "debug",
"ts": 1670177114.3610454,
"logger": "http.handlers.reverse_proxy",
"msg": "upstream roundtrip",
"upstream": "192.168.1.3:6061",
"duration": 0.014817828,
"request": {
"remote_ip": "2.2.2.2",
"remote_port": "55725",
"proto": "HTTP/1.1",
"method": "PUT",
"host": "webdav.example.com",
"uri": "/banking4i/Meine%20Banken.sub",
"headers": {
"X-Forwarded-Host": [
"webdav.example.com"
],
"X-Forwarded-Port": [
"443"
],
"Expect": [
"100-continue"
],
"Authorization": [],
"Content-Type": [
"application/octet-stream"
],
"X-Real-Ip": [
"2.2.2.2"
],
"Content-Length": [
"196608"
],
"X-Forwarded-For": [
"2.2.2.2"
],
"X-Forwarded-Proto": [
"https"
],
"User-Agent": [
"Mozilla/5.0 (Subsembly.Interweb)"
]
},
"tls": {
"resumed": false,
"version": 771,
"cipher_suite": 49195,
"proto": "",
"server_name": "webdav.example.com"
}
},
"headers": {
"Etag": [
"\"172da93c8d59d66430000\""
],
"Date": [
"Sun, 04 Dec 2022 18:05:14 GMT"
],
"Content-Length": [
"7"
],
"Content-Type": [
"text/plain; charset=utf-8"
]
},
"status": 201
}
Debug output of Caddy 2.6.0-beta.3:
{"level":"debug","ts":1670177345.0879314,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"192.168.1.3:6061","total_upstreams":1}
panic: invalid WriteHeader code 0
goroutine 188 [running]:
net/http.checkWriteHeaderCode(...)
net/http/server.go:1116
net/http.(*response).WriteHeader(0xc00067c2a0, 0x0)
net/http/server.go:1150 +0x9db
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*responseRecorder).WriteHeader(0xc0006f9650?, 0x0?)
github.com/caddyserver/caddy/v2@v2.6.0-beta.3/modules/caddyhttp/responsewriter.go:178 +0xbd
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*responseRecorder).WriteHeader(0xc0006f97a0?, 0x0?)
github.com/caddyserver/caddy/v2@v2.6.0-beta.3/modules/caddyhttp/responsewriter.go:178 +0xbd
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*responseRecorder).WriteHeader(0xc0009d4d08?, 0xc0009d4cb0?)
github.com/caddyserver/caddy/v2@v2.6.0-beta.3/modules/caddyhttp/responsewriter.go:178 +0xbd
github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy.(*Handler).reverseProxy.func1(0xc00061b920?, 0xc0005bc900?)
github.com/caddyserver/caddy/v2@v2.6.0-beta.3/modules/caddyhttp/reverseproxy/reverseproxy.go:783 +0x5d
net/http.(*persistConn).readResponse(0xc000995680, {{}, 0xc0005bc900, {0xc0005bc800}, 0xc000258c00, 0x1, 0xc000258b40, 0xc000258ba0}, 0xc000637580)
net/http/transport.go:2313 +0x20c
net/http.(*persistConn).readLoop(0xc000995680)
net/http/transport.go:2108 +0x3aa
created by net/http.(*Transport).dialConn
net/http/transport.go:1751 +0x173e
Debug output of Caddy 2.6.0-beta.5 and later (2.6.2 and also :latest
Docker image from today):
{
"level": "debug",
"ts": 1670177188.2818708,
"logger": "http.handlers.reverse_proxy",
"msg": "upstream roundtrip",
"upstream": "192.168.1.3:6061",
"duration": 0.020302583,
"request": {
"remote_ip": "2.2.2.2",
"remote_port": "55749",
"proto": "HTTP/1.1",
"method": "PUT",
"host": "webdav.example.com",
"uri": "/banking4i/Meine%20Banken.sub",
"headers": {
"X-Forwarded-For": [
"2.2.2.2"
],
"X-Forwarded-Host": [
"webdav.example.com"
],
"User-Agent": [
"Mozilla/5.0 (Subsembly.Interweb)"
],
"Expect": [
"100-continue"
],
"Authorization": [],
"Content-Type": [
"application/octet-stream"
],
"X-Real-Ip": [
"2.2.2.2"
],
"Content-Length": [
"196608"
],
"X-Forwarded-Proto": [
"https"
],
"X-Forwarded-Port": [
"443"
]
},
"tls": {
"resumed": false,
"version": 771,
"cipher_suite": 49195,
"proto": "",
"server_name": "webdav.example.com"
}
},
"headers": {
"Date": [
"Sun, 04 Dec 2022 18:06:28 GMT"
],
"Content-Length": [
"7"
],
"Content-Type": [
"text/plain; charset=utf-8"
],
"Etag": [
"\"172da94dc2fec6e530000\""
]
},
"status": 201
}
My own Caddy image includes module caddy-trace
.
Output of caddy-trace Caddy 2.5.2:
{
"level": "debug",
"time": "2022-11-29T12:36:46.185Z",
"msg": "debugging request",
"request_id": "7cee08d6-e386-45a8-92f0-2e7024b8262c",
"direction": "incoming",
"tag": "",
"method": "PUT",
"proto": "HTTP/1.1",
"host": "webdav.example.com",
"uri": "/banking4i/Meine%20Banken.sub",
"remote_addr_port": "2.2.2.2:55350",
"remote_addr": "2.2.2.2",
"remote_port": 55350,
"content_length": 4520448,
"cookie_count": 0,
"user_agent": "Mozilla/5.0 (Subsembly.Interweb)",
"referer": "",
"cookies": [],
"query_params": {},
"headers": {
"Authorization": "Basic xx ",
"Content-Length": "4520448",
"Content-Type": "application/octet-stream",
"Expect": "100-continue",
"User-Agent": "Mozilla/5.0 (Subsembly.Interweb)"
},
"form": {}
}
{
"level": "debug",
"time": "2022-11-29T12:36:46.315Z",
"msg": "debugging response",
"request_id": "7cee08d6-e386-45a8-92f0-2e7024b8262c",
"direction": "outgoing",
"tag": "",
"status_code": 201,
"response_size": 7,
"buffer_size": 7,
"response_headers": {
"Content-Length": [
"7"
],
"Content-Type": [
"text/plain; charset=utf-8"
],
"Date": [
"Tue, 29 Nov 2022 12:36:46 GMT"
],
"Etag": [
"\"172c0e6913785c5944fa00\""
],
"Server": [
"Caddy"
],
"Strict-Transport-Security": [
"max-age=63072000; includeSubDomains; preload"
]
}
}
Output of caddy-trace Caddy 2.6.2:
{
"level": "debug",
"time": "2022-11-29T12:38:26.518Z",
"msg": "debugging request",
"request_id": "3498c983-b106-440d-a5e9-8169b8647311",
"direction": "incoming",
"tag": "",
"method": "PUT",
"proto": "HTTP/1.1",
"host": "webdav.example.com",
"uri": "/banking4i/Meine%20Banken.sub",
"remote_addr_port": "2.2.2.2:55714",
"remote_addr": "2.2.2.2",
"remote_port": 55714,
"content_length": 4520448,
"cookie_count": 0,
"user_agent": "Mozilla/5.0 (Subsembly.Interweb)",
"referer": "",
"cookies": [],
"query_params": {},
"headers": {
"Authorization": "Basic xx ",
"Content-Length": "4520448",
"Content-Type": "application/octet-stream",
"Expect": "100-continue",
"User-Agent": "Mozilla/5.0 (Subsembly.Interweb)"
},
"form": {}
}
{
"level": "debug",
"time": "2022-11-29T12:38:26.650Z",
"msg": "debugging response",
"request_id": "3498c983-b106-440d-a5e9-8169b8647311",
"direction": "outgoing",
"tag": "",
"status_code": 201,
"response_size": 7,
"buffer_size": 7,
"response_headers": {
"Alt-Svc": [
"h3=\":443\"; ma=2592000"
],
"Content-Length": [
"7"
],
"Content-Type": [
"text/plain; charset=utf-8"
],
"Date": [
"Tue, 29 Nov 2022 12:38:26 GMT"
],
"Etag": [
"\"172c0e806fcbcbc544fa00\""
],
"Strict-Transport-Security": [
"max-age=63072000; includeSubDomains; preload"
]
}
}
2.2.2.2 is placeholder for my Internet public IP address.
I can’t find anything what could be wrong from all this debug output, but it feels there is an incompatibility (or bug?) introduced after Caddy 2.6.0
Client Software is Banking4:
https://subsembly.com/banking4.html
It doesn’t matter if I use iOS or macOS version. With Caddy 2.5.2 both platform upload their backup files, after Caddy 2.6.0 upload hangs. Other WebDAV software works, also download from WebDAV always works with Banking4!
With macOS I have tried different Banking4 versions, behave all the same: with Caddy 2.5.2 it works, after 2.6.0 the upload dialog window of Banking4 hangs and only closes after reloading (not stopping) Caddy.