Nextcloud Webdav Issue

1. Output of caddy version:

v2.5.2 h1:eCJdLyEyAGzuQTa5Mh3gETnYWDClo1LjtQm2q9RNZrs=

2. How I run Caddy:

a. System environment:

Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy
Client: Docker Engine - Community
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.18.9
 Git commit:        3a2c30b
 Built:             Thu Dec 15 22:28:04 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.22
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.9
  Git commit:       42c8b31
  Built:            Thu Dec 15 22:25:49 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.15
  GitCommit:        5b842e528e99d4d4c1686467debf2bd4b88ecd86
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Docker Compose version v2.0.1

b. Command:

N/A docker caddy - see above

c. Service/unit/compose file:

d. My complete Caddy config:

3. The problem I’m having:

The problem I am having is webdav does not fuction. If I use it locally uisng my ip address it works, but if I use it through caddy, my webdav does not work.

4. Error messages and/or full log output:

The error I see in docker logs is below, there is no error in nextcloud.

{"level":"error","ts":1673983439.6325216,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"write tcp 172.27.0.55:443->172.27.0.1:50784: write: broken pipe"}
{"level":"error","ts":1673983474.633873,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"write tcp 172.27.0.55:443->172.27.0.1:50804: write: broken pipe"}
{"level":"error","ts":1673983509.6356308,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"write tcp 172.27.0.55:443->172.27.0.1:50796: write: broken pipe"}.

5. What I already tried:

I have trouble shooted it to verify if it is Caddy or Nextcloud and got it down to Caddy. I have searched the forums, but most seemed to be related to nextcloud overall, not just webdav not working. I have gone to the webdav url and it seems to properl;y show, just shows a message that it cant be view in a browser.

6. Links to relevant resources:

My understanding is you might need to do a redirect or rewrite for certain paths to make WebDAV work. You can search the forums to find NextCloud examples which have it.

Also, there’s no benefit to proxying to NextCloud over HTTPS. Switching to HTTP might get you some additional performance as well, since HTTPS adds some overhead.

Please upgrade to the latest version, v2.6.2.

I updated to 2.6.2 and added this and same concerns… I dont see anything in the caddy log even in debug, which seems odd? I get the https thing, but Im going to ignore that part for the time being since that is the default for the LSIO container.

I use cloudflare tunnels, but those arent involved in this case as I use my DNS to rewrite anything from my domain to my server directly to avoid loopback and speed things up.

My new nextcloud code is:

	handle @nextcloud {
		redir /.well-known/carddav /remote.php/dav 301
		redir /.well-known/caldav /remote.php/dav 301
		reverse_proxy https://nextcloud:443 {
			import proxyheaders

			transport http {
				tls
				tls_insecure_skip_verify
			}
		}
	}

Ignore this, my ISP reset my router on me and it changed my DNS which was causing loopback issues!

1 Like