405 "Method Not Allowed" with Caddy v2 + webdav

1. Caddy version (caddy version):

v2.2.1 h1:Q62GWHMtztnvyRU+KPOpw6fNfeCD3SkwH7SfT1Tgt2c=

2. How I run Caddy:

Run directly with a Caddyfile.

a. System environment:

Mac 10.15.7, command line.

b. Command:

./caddy_darwin_amd64_custom run

c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:

localhost

root * .

route {
	webdav {
	}
	file_server
}

3. The problem I’m having:

Using Edge browser, https://localhost works fine, returning back the webdav XML files. However, use curl -I to access the same URL (and test HEAD request for sure), it returns 405 Method Not Allowed.

4. Error messages and/or full log output:

HTTP/1.1 405 Method Not Allowed
Server: Caddy
Date: Fri, 18 Dec 2020 12:59:05 GMT

5. What I already tried:

Tried HTTPS, HTTP with verified Caddyfile chages (verified by basic GET requests from browsers), but HEAD request always returns 405.

6. Links to relevant resources:

Looks like you’re being helped on the github issue:

https://github.com/mholt/caddy-webdav/issues/19

Yes - I asked similar question there but no direct answer to why 405 is returned to HEAD request. Please check the response to HEAD /webdav below.

caddy | {“level”:“error”,“ts”:1608340726.962795,“logger”:“http.log.access.log0”,“msg”:“handled request”,“request”:{“remote_addr”:“172.19.0.1:58836”,“proto”:“HTTP/1.1”,“method”:“HEAD”,“host”:“127.0.0.1:9000”,“uri”:"/webdav",“headers”:{“User-Agent”:[“curl/7.64.1”],“Accept”:["/"]}},“common_log”:“172.19.0.1 - admin [19/Dec/2020:01:18:46 +0000] “HEAD /webdav HTTP/1.1” 405 0”,“duration”:0.0044735,“size”:0,“status”:405,“resp_headers”:{“Server”:[“Caddy”],“Date”:[“Sat, 19 Dec 2020 01:18:46 GMT”]}}

Here is the response to HEAD / to another running Caddy instance at different port,

caddy | {“level”:“error”,“ts”:1608340881.9617891,“logger”:“http.log.access.log1”,“msg”:“handled request”,“request”:{“remote_addr”:“172.19.0.1:53140”,“proto”:“HTTP/1.1”,“method”:“HEAD”,“host”:“127.0.0.1:8889”,“uri”:"/",“headers”:{“User-Agent”:[“curl/7.64.1”],“Accept”:["/"]}},“common_log”:“172.19.0.1 - admin [19/Dec/2020:01:21:21 +0000] “HEAD / HTTP/1.1” 405 0”,“duration”:0.0006574,“size”:0,“status”:405,“resp_headers”:{“Server”:[“Caddy”]}}

https://stackoverflow.com/questions/16578345/should-webdav-server-support-head-on-folders

This link shows HEAD better be supported per RFC.

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