mholt / caddy-webdav

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

Is it possible to have directory listing with WebDAV enabled in the same path? #20

Closed ghost closed 3 years ago

ghost commented 3 years ago

Based on the documents and my test, it seems like WebDAV has to be served in a different path with directory listing, one cannot have them both functioning under the same path, is that correct?

As an Apache & Nginx user, I felt quite surprised, as it is an expected behaviour to have them working in the same path.

Cheers, Jayden

wader commented 3 years ago

Haven't tried but maybe you could somehow combine method GET { ... } and {http.matchers.file.type} to make browse handle those request? I think that should be fine as WebDAV useu PROPLIST method for directories.

Zeethulhu commented 3 years ago

Using matchers is probably the way to go.

@JaydenMcEncroe This may work for you. (Untested)

localhost:80 {

@notget {
  not method GET
  }

    root * /www
    file_server browse
    webdav @notget
}
noerw commented 3 years ago

With the proper order it works, thanks!

{
  order webdav before file_server
}

localhost

@notget {
  not method GET
}

root * /www
webdav @notget 
file_server browse

Or alternatively, for a public listing, but authenticated dav:

localhost
root * /www

@notget {
  not method GET
}

route @notget {
  basicauth {
    davuser JDJhJDE0JGJXeGVmeHgzUmREVFc0dHpFbUZEaC5ZYW5QemVLVXBxUUtGLkpRSUxveDVRRE9pbVVNTGNL
  }
  webdav
}

file_server browse