caddy-webdav
caddy-webdav copied to clipboard
405 Method not allowed on default configuration
Clean download (from https://caddyserver.com/download) and installation of Caddy2+webdav on Mac OS Catalina.
Browser gets status code 405 and shows Method not allowed for https://localhost/dav, with Caddyfile extracted from Readme as below,
localhost
root * /srv
route { rewrite /dav /dav/ webdav /dav/* { prefix /dav } file_server } <<<
If replaced it with below (basically remove rewrite and prefix), everything works with http://localhost URL.
localhost root * /srv route { webdav { } file_server } <<<
Cannot find any clues anywhere :(... please kindly share any advices. Thanks.
Your browser? This is a webdav server. What is the request your browser is making?
Edit: This is probably correct, though, note the readme explains this already:
The
prefix
directive is optional but has to be used if a webdav share is used in combination with matchers or path manipulations. This is because webdav uses absolute paths in its response. There exist a similar issue when using reverse proxies, see The "subfolder problem", OR, "why can't I reverse proxy my app into a subfolder?".
I tried Chrome, and Edge. Both results are the same.
I'd like to have a prefix there for webdav, because I want to keep original file_server URL unchanged. So client/browser can access file server at https://localhost/ and access webdav at https://localhost/dav.
Another interesting finding is that, even the latter Caddyfile works (w/o prefix), a HEAD request from client will return the same 405. I do not know why, but some WebDAV client checks HEAD request as well for webdav server. Now this caddy webdav module returns 405 so basically those clients cannot work with Caddy2+webdav.
Any insights?
try caddyfile like this
http://localhost:5001 root * /www
@notget { not method GET }
route @notget { basicauth { ricky JDJhJDE0JGlqRTI4b0ZXNExOTi5iUGdTeGJXTU9uL3JySXdaeXdLbHRIcUptdWdoLnAwNTN5ZWYySmlX } webdav }
file_server browse