LoveCaddy
(LoveCaddy)
February 1, 2022, 5:45am
1
1. Caddy version (caddy version
):
2.4.6 + webdav plugin
2. How I run Caddy:
a. System environment:
OS : Ubuntu 20.04
Docker : 20.10.12
AlpineX latest version
b. Command:
caddy start
c. Service/unit/compose file:
d. My complete Caddyfile or JSON config:
{
root * /home/webdav
route {
rewrite /dav /dav/
basicauth {
{$user} {$password}
}
webdav /dav/* {
prefix /dav
}
file_server browse
}
}
3. The problem I’m having:
I want to have more than one webdav user with its own folder separately.
4. Error messages and/or full log output:
Only one user only can be created and be used.
5. What I already tried:
Tried some config but everything gives error
6. Links to relevant resources:
What did you try? What errors?
LoveCaddy
(LoveCaddy)
February 2, 2022, 3:13am
3
Hi,
I did test some config like :
Config 1 :
{
root * /home/webdav/USER1
route {
rewrite /dav /dav/
basicauth {
{$user1} {$password1}
}
webdav /dav/* {
prefix /dav
}
file_server browse
}
root * /home/webdav/USER2
route {
rewrite /dav /dav/
basicauth {
{$user2} {$password2}
}
webdav /dav/* {
prefix /dav
}
file_server browse
}
}
and
Config 2 :
{
basicauth / super userpwd
basicauth / user2 userpwd
basicauth / user3 userpwd
basicauth / user4 userpwd
webdav {
super:
scope /home/DATA/webdav
user2:
scope /home/DATA/webdav/.user2
user3:
scope /home/DATA/webdav/.user3
user4:
scope /home/DATA/webdav/.user3
}
log /etc/caddy/access-webdav.log
}
LoveCaddy
(LoveCaddy)
February 2, 2022, 4:19am
4
Example of error :
INFO using adjacent Caddyfile
run: adapting config using caddyfile: parsing caddyfile tokens for 'webdav': Caddyfile:15 - Error during parsing: unrecognized subdirective: super:
LoveCaddy
(LoveCaddy)
February 2, 2022, 4:49am
5
I tried this too but all user is logged into the same directory. I need each user has their own directory.
{
root * /home/webdav
route {
rewrite /dav /dav/
basicauth {
{user1} {passwordhas1}
{user2} {passwordhas2}
}
webdav /dav/* {
prefix /dav
}
file_server
}
}
Please help me
What you could do is this, i.e. use the username as the directory to set as root
:
route /dav* {
rewrite /dav /dav/
basicauth {
bob <password>
alice <password>
}
root * /home/webdav/{http.auth.user.id}
webdav {
prefix /dav
}
}
LoveCaddy
(LoveCaddy)
February 2, 2022, 6:21am
7
Hi,
I’ve tried the example config :
Some errors occurs.
On Webdav Client, get error 404
url config :
dav.someurl.ext:PORT\dav\
On Docker log :
ERROR http.handlers.webdav internal handler error {"error": "stat /home/webdav/bob: no such file or directory", "request": {"remote_addr": "someaddr", "proto": "HTTP/1.1", "method": "PROPFIND", "host": "somehost", "uri": "/dav/", "headers": {"Content-Length": ["156"], "Connection": ["Keep-Alive"], "User-Agent": ["WebDAV 123"], "Authorization": ["Basic 123"], "Accept-Encoding": ["gzip"], "Depth": ["1"], "Content-Type": ["text/xml"]}}}
Does /home/webdav/bob
actually exist?
I was giving those usernames as examples. Put in the exact username you want to support in there instead.
LoveCaddy
(LoveCaddy)
February 2, 2022, 7:43am
9
Edit:
After some trial and error it works.
I just need the url to be :
dav.someurl.tld:PORT/dav/
No need to add user dir at the end.
If you don’t mind, I want to ask another problem.
Is it possible to have the folders publicly accessible? and served using Digestauth.
Previously I can access it with file_server browse
and basicauth.
Hi,
I created “bob” folder beforehand.
So the full url is
dav.someurl.tld:PORT/dav/bob/
LoveCaddy
(LoveCaddy)
February 3, 2022, 4:38am
10
Hi @francislavoie
Is it do able?
Having both active at the same time (WebDav and File_server browse with authentication).
I can do Webdav + File_server browse but not with the authentication.
Am I missing something here?
LoveCaddy
(LoveCaddy)
February 6, 2022, 5:35am
11
Hi,
Finally I can make this work. Webdav multiuser with their own folder and is accessible through public (http port 443) and also with authentication.
Thanks @francislavoie for your help.
Maybe this was an easy steps for everyone here but not for me unfortunately.
Anyway, I will change the status to Solved now.
2 Likes
system
(system)
Closed
March 3, 2022, 5:45am
12
This topic was automatically closed after 30 days. New replies are no longer allowed.