-
Notifications
You must be signed in to change notification settings - Fork 0
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
Suggestion: Write so as to be able to add on to existing configuration #1
Comments
Hello! You welcome, really glad this configuration sample was helpful in your neat router setup 😃 Modularizing the core webdav-related config for users to plug into their existing setups sounds like a great idea. I'll get to work on it and keep you updated For now, I'll keep these as the first goals:
Then the tricky one:
As of adding this config to the OpenWrt wiki, it's pretty much welcome. I published this snippet here to hopefully be of help to others working out a very lightweight WebDAV server with a nice web UI but this repo is quite a lost spot nowhere in the internet. In the OpenWrt wiki it could sure get more visibility and help a lot more people |
Hello, a small update: As a brief, the problem is: As lighttpd and mod_webdav seem unreliable at doing this, only left option (beyond source patching, of course) is setting up the path remapping at a lower level, like at filesystem level via symlinks. |
Sorry for the big delay, been dealing with some life stuff lately. @VA1DER are you still checking on here and interested? So last resort... bind mounts! Things gets uglier 😆 |
@Code-Otto Hi! I am the lighttpd developer who wrote the current lighttpd mod_webdav. If the client side is unable to handle a WebDAV folder root with URL path Using lighttpd Instead of using lighttpd Alternatively, you could enable lighttpd Lots of options. Feel free to ask me questions. I may not understand exactly what you're trying to do. RFE: add lighttpd |
Why is this in the sample config?
The default is |
@Code-Otto
I ask because lighttpd 1.4.71 and later provide a default for How common are the following multimedia types? These are not currently part of the defaults provided by lighttpd, but I might be convinced to add them:
|
FYI: I submitted a PR to upstream to add a lighttpd example: dom111/webdav-js#130 In the PR, instead of playing tricks with mod_dirlisting or mod_indexfile, I wrote a little lua script to overlay and provide the page to use webdav-js to generate the index for WebDAV collections. |
Hello @gstrauss! Nice to have you around 😃 I've not yet published the configuration drop-in I've been working on so it should be hard for you to understand what we are trying to achieve. Let's solve it... 😉
What we were trying to work out is:
However I've been unsuccessful at getting mod_webdav to map
Yes, thanks for the confirmation. This is the approach I've been heading for.
That was my original idea, however this piece of information about symlinks in the mod_webdav wiki documentation suggested they won't be followed for security reasons and discourages their use within a WebDAV document root, hence why I discarded the option and considered bind mounts (albeit an even uglier hack): https://redmine.lighttpd.net/projects/lighttpd/repository/14/revisions/6bf0b577876b3e6d5e84239c8c134d436ed29b1b
Noted, thanks! Will add it
That's an issue I came across only alongside the webdav-js client, may probably be an issue on its side.
It's fine 😃
It's based off Debian/Ubuntu defaults with some custom additions of mine
Most these are obsolete formats or things that do not anyways benefit from rich previews under any browser. However
Thanks a lot! I'll check out your approach there |
lighttpd 1.4.72 was just released this evening; I did not get your response until now. :/ I may consider .mkv for the future. I made a mistake above and need to correct myself regarding symlinking
FYI: lighttpd.conf allows
I do not understand. You stated above that you wanted the dav to be in a subpath ("/dav") ("Runs non-intrusively below a subpath") and at the same time are trying to map "/dav/" to "/"? This combination does not make sense to me. I can only assume it relates to your attempts to use lighttpd mod_alias to map webdav-js files elsewhere.
lighttpd mod_webdav expects that the filesystem tree is a single tree for the top-level dav collection. For example, a WebDAV MOVE command would not have coherent results if you MOVE /dav/foo to /dav/bar, but also had mod_alias map /dav/foo/other/ to some place outside the tree. The files under /dav/foo/other would not end up moving to the MOVE target /dav/bar/other. (You might say that this does not affect your specific use, but I am explaining why lighttpd mod_webdav expects to manage a single filesystem tree for coherent results.) The reason the GET works in your case using mod_alias is that lighttpd mod_webdav allows other modules to handle GET, so that GET might result in lighttpd mod_fastcgi running the target instead of returning the file contents, based on whether or not lighttpd mod_magnet with a short custom lua script -- as I mocked up (in the PR I linked above) -- is a clean way IMHO to overlay webdav-js in the way that you want, without trying to play tricks with lighttpd mod_indexfile or lighttpd mod_dirlisting, and at the same time not affecting the rest of the site that is not under the /dav/ subpath. |
This might be a useful template (untested by me) for what you want to achieve, using the lua script in PR dom111/webdav-js#130
You could add |
I explained myself quite poorly there indeed, sorry: For example let's say I'd like my personal Pi-powered cloud running many different web services at home to serve the contents of a external disk I've plugged at it. The disk is automounted at a fixed path at system boot, let's say at
This seems reasonable, I understand mod_alias offers much more flexibility than what mod_webdav can handle hence why the limitations.
I've just taken a look at it and its definitely such a more elegant solution. Didn't know about mod_magnet but it looks extremely powerful so will look into learning more about it, thanks for the pointer. |
Hard no. If you have a large tree containing 100,000 files, you're asking lighttpd to look at every single one to see if something else mapped things differently. Hard no. Handling symlinks is similar. unix-style symlinks are not part of the WebDAV standard. lighttpd does not analyze those 100,000 files to see if any is a symlink, and if it is a relative symlink, and then does not update that symlink if it is a relative symlink and the symlink is under a tree that has COPY or MOVE applied. lighttpd modules are generally independent of one another, since the use of each module is optional. One could also write a custom lighttpd module, and lighttpd mod_webdav would not magically know what that custom module does.
Untested, but as posted above, I think this might work:
That should work with a read-only WebDAV root. |
FYI: I took a quick look in the lighttpd mod_webdav code and it looks like lighttpd mod_webdav will handle using mod_alias to map the WebDAV root of a writable collection, e.g. with Please test and report what you find. |
BTW, I think one of your original misunderstandings may have been this:
|
Thanks for all the insights, now it's time I do my homework 😄 |
This appears to work fine: (alternative to the PR using mod_magnet, which also works)
with
If you had to do that without using regular expressions, you could instead:
The target "/path/to/my/files" still needs to exist and be properly permissioned. |
Hey @gstrauss, I'm getting hold of mod_magnet and it seems to expose enough lighttpd wizardry internals for me to eventually achieve the goal from this issue 😄 Currently writing a Lua script to handle the physical path as I please, and two questions arised (hope you're fine with me asking around here):
|
I came across a showstopper unfortunately :c From within my Lighttpd conf file I call the Lua script with: local method = lighty.env["request.method"]
print("Method is: " .. method)
return 0 I've noticed WebDAV HTTP methods cannot be handled with mod_magnet. Here's a log of me doing some WebDAV operations with webdav-js:
Notice how the Lua code is not executing for PROPFIND, MKCOL or MOVE requests, the ones I need to mess with the more. (tested both with Lighty 1.4.59 and a freshly compiled 1.4.72) |
No. lighttpd config file parsing is isolated from everything else in lighttpd. However, you can use mod_setenv and configure lighttpd.conf to set an environment variable using your var.webdav-prefix value that is visible from the lua environment. Accessing an environment variable in mod_magnet lua script does trigger mod_magnet environment generation for every request, which is a bit of extra work in lighttpd and can be avoided if you do not need to do it. (It is an optimization to avoid it unless needed) However, webdav filesystem actions are much more work and so you probably won't notice the slight additional overhead. Recommendation:
The document root is the original document root, e.g. for the virtual host. basedir can change depending on mod_alias, mod_userdir, and others. As you noticed, if basedir is not changed by another module, it matches doc-root.
No, not a showstopper in lighttpd. You must be doing something incorrectly. Here's my hunch based on the limited information you have provided: lighttpd module load order matters, as that is the order that modules are given the change to handle requests (for a given module-registered lighttpd hook in request handling). |
Understood, I'll live without it for now then.
Oh yes, I've already found out myself why that's a bad idea 😅 thanks for pointing out
Hrrrrmmmmm I think you quite caught me! Changed the modules order and the script is working as desired, thank you! |
Thanks for this fantastic configuration! It was extremely helpful getting a nice WebDAV interface on my OpenWrt router.
The Wiki for OpenWrt has a /very/ basic configuration which requires a copy of webdav-js for each served folder. My intention is to update the wiki with an adaptation of your solution (with attribution). It has to, however, play nicely with other configurations since lighttpd is also serving up my router's UI.
In the short term, I was able to get it to play nicely by surrounding the WebDAV configuration with a $SERVER directive. I then added in some basic auth and proceeded with an adaptation of your config...
I wanted to suggest that your solution would be much more universal if it was designed as drop-in configuration to tack onto existing configurations by adding, say, a
50-weddav.conf
file into/etc/lighttpd/conf.d
and was written such that it complements existing setups. So it could be set to work with address/webdav/ and address/webdav/basic/. As is stands, it assumes it will be all that lighttp is doing.In any case, thanks again for doing this. It has been a great help.
The text was updated successfully, but these errors were encountered: