mholt / caddy-webdav

WebDAV handler module for Caddy
Apache License 2.0
228 stars 24 forks source link

root directive appears to ignore {http.auth.user.id} #39

Open drhaynes opened 1 year ago

drhaynes commented 1 year ago

I am trying to setup a multi-user WebDAV configuration.

I have things configured in the Caddyfile as follows:

*.example.com {
   ...
   @storage host storage.example.com
   handle @storage {
      basicauth {
         username1 <hashed_pw>
         username2 <hashed_pw>
      }
      root * /path/to/webdav/{http.auth.user.id}
      webdav
   }
   ...
}

Which is working, but the individual users see the root of the webdav path when they connect (i.e. /path/to/webdav/, not /path/to/webdav/user1 as expected.)

It appears someone else ran into the same issue, as posted here: https://caddy.community/t/multiple-users-with-different-roots-in-webdav/19502

But they never replied to the debugging suggestions.

As suggested, I turned on debugging and tried the custom X-Auth header. From that, I can see the username from {http.auth.user.id} as expected in the response.

Other than that, there don't appear to be any debug messages indicating a problem.

I'm not hugely familiar with go, but I also took a look at the Caddyfile parsing code for this module, and it all looks pretty straightforward and boiler-platey, so it doesn't seem likely the issue would be there.

Any ideas?