Multiple users with different roots in webdav

1. The problem I’m having:

I’m trying to setup a multi user webdav service with caddy. This means that every user should have it’s own root / working subdirectory after login. On another post in this forum someone mentioned to use the variable {http.auth.user.id} in the root section at the config. However, I still end up in the root directory (/mnt/share in my case).

2. Error messages and/or full log output:

no error message / output

3. Caddy version:

v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=

4. How I installed and ran Caddy:

a. System environment:

Debian 11, native with APT repository provided by Caddy

b. Command:

systemctl start/stop/restart caddy

d. My complete Caddy config:

dav.home {
        tls internal

        basicauth {
                user1 $2a$14$LLZO./8BRP.XGA1a1bTSje4fTmm8PVpbdV9UneQhZzrYSoH1LYtb6
                user2 $2a$14$LZYJQeS8vvNqowDomTu8zexTeFQ2YuwFC1f70j4g2iHoE7O4x8K62
        }

        root * /mnt/share/{http.auth.user.id}/
        webdav
}

5. Links to relevant resources:

Turn on the debug global option. Does it show anything more in the logs? I’m not sure if the webdav plugin does any debug logging, but it might help.

Add this to your config:

header {
	X-Auth {http.auth.user.id}
	defer
}

Then, make a request with curl -v -u'user1:password' https://dav.home

What do you see in the response headers? It should show you X-Auth: user1 ideally.

Are you sure that’s your entire config? How are you setting the directive order for webdav?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.