Closed faicker closed 4 years ago
Can you provide some details what happens, logs, examples request/response and what you expected?
Also see comment about prefix
https://github.com/mholt/caddy-webdav/blob/master/webdav.go#L29
@mholt maybe prefix should be documented somewhere, like in README?
thanks. If the prefix is added, The upload is working.
prefix /share
Yeah, the readme should probably be updated.
It's a bit unfortunate that prefix is needed at all, since Caddy is capable of manipulating the URI with its other directives. But I don't know how to make our webdav dependency work without the prefix in certain situations. It'd be nice to find a way to not need that anymore.
I've tried to come up with something also but failed so far. Somehow keep track of matchers and or uri changes to let directives know what the "original" prefix is seems very messy? and in the webdav case i guess it would only work with some kind a match patterns?
As I understand the webdav spec the root of the issue is that the "href" response element for PROPFIND is required to be a URI or a "relative reference" which seems to mean an absolute path. Maybe this should be mentioned somehow?
Somehow keep track of matchers and or uri changes to let directives know what the "original" prefix is seems very messy?
I was thinking more like:
handle_path /path/* {
webdav
}
but if the webdav handler is crafting URIs for the response, it will still need to know that the /path
portion of the URI existed before it was stripped. This is actually available through orig_uri
placeholders, but of course the webdav library dependency doesn't know about those...
Aha, could the default prefix value be some placeholder variable similar to how the root default value "{http.vars.root}"
works? but i wonder how one could keep track of what part of the uri that has been matched and what part to pass as path to webdav library? sorry if misunderstand or is using the wrong caddy terminology, haven't digged much into caddy internal yet :)
@faicker can close?
@wader I get what you mean. It could probably be done with regular expressions, where you can name a capture group and then refer to those with placeholders in the subsequent route. But that seems like overkill...
@mholt That could work :) but i agree hard to find a elegant solution it seems
@wader yes, thanks.
not working.