Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

405 Method not allowed on default configuration #19

Open
shural opened this issue Dec 18, 2020 · 4 comments
Open

405 Method not allowed on default configuration #19

shural opened this issue Dec 18, 2020 · 4 comments

Comments

@shural
Copy link

shural commented Dec 18, 2020

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.

@mholt
Copy link
Owner

mholt commented Dec 18, 2020

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?".

@shural
Copy link
Author

shural commented Dec 18, 2020

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?

@rickywu
Copy link

rickywu commented Jun 24, 2021

try caddyfile like this

http://localhost:5001
root * /www

@notget {
not method GET
}

route @notget {
basicauth {
ricky JDJhJDE0JGlqRTI4b0ZXNExOTi5iUGdTeGJXTU9uL3JySXdaeXdLbHRIcUptdWdoLnAwNTN5ZWYySmlX
}
webdav
}

file_server browse

@oxalica
Copy link

oxalica commented Aug 24, 2024

I'm still reproducing this issue on the latest caddy-webdav (with #28 merged). cc @mcieno
The issue only exists when setting prefix /webdav. Remove prefix and creating sub-folders the same as prefix under root can workaround it. Would it be something wrong about prefix processing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants