Module: mod_webdav


The WebDAV module is a minimalistic implementation of RFC 2518. Minimalistic means that not all operations are implemented yet.

So far we have:

  • COPY
  • MOVE
  • PUT
  • LOCK

and the usual GET, POST, HEAD from HTTP/1.1.

If you want to setup a WebDAV repository with authentication, make sure you are loading mod_webdav `before` mod_auth.

So far, mounting an open-access WebDAV resource into Windows XP (Network Places), Mac OS X (Finder) and Linux (Konqueror) works. Mounting an authenticated WebDAV resource works in Mac OS X and Linux. The basic litmus tests are passed.


mod_webdav is part of the 1.4.x distribution.


If you are only looking for PUT and DELETE support, the basic mod_webdav works for you. No special compile-time options or libraries are required. PUT and DELETE are already part of the HTTP/1.1 spec, but are mostly used in combination with WebDAV.


PROPFIND and PROPPATCH are used to do a directory-listing and to attach properties to a file-object.

As this involves parsing of XML-data we need libxml2. To make PROPPATCH work you need sqlite3 to store the properties in a separate location:

  • libxml2

    libxml2 libxml2-devel

  • sqlite3

    sqlite sqlite-devel

To compile mod_webdav with property-support you have to specify: ::

$ configure --with-webdav-props


LOCK and UNLOCK are necessary to get mounting of file-systems working. This involves generate unique lock-tokens. We use libuuid for this job.

  • libuuid

    e2fsprogs e2fsprogs-devel

LOCK with includes parsing XML again, so have to provide the dependencies of the previous section and libuuid: ::

$ ./configure --with-webdav-props --with-webdav-locks


If you load the webdav module, the WebDAV functionality has to be enabled for the directories you want to provide to the user.

Default: disable
Only allow reading methods (GET, PROPFIND, OPTIONS) on WebDAV resources.

Default: writable

The full path to the file you would like to use as your db file. This is required for webdav props and locks.

Default: <empty>


To enable WebDAV for the /dav directory, you wrap your webdav options in a conditional. You have to use the regex like below as you want to match the directory /dav and everything below it, but not e.g. /davos. ::

  $HTTP["url"] =~ "^/dav($|/)" {
    webdav.activate = "enable" = "enable" 
    webdav.sqlite-db-name = "/var/run/lighttpd/lighttpd.webdav_lock.db" 

If you would like LOCK support ::

  $HTTP["url"] =~ "^/dav($|/)" {
    webdav.activate = "enable" = "disable" 
    webdav.sqlite-db-name = "/var/run/lighttpd/lighttpd.webdav_lock.db" 

note : The WebDAV directory should be a child of the document root. So if you want to add a server.document-root option to the /dav configuration, the path should be a child of the server.document-root (Otherwise move and copy function will not work correctly). (Take a look in mod_webdav.c line 1830)

litmus tests

We use (version 0.13) to verify that we support at least the basic of the WebDAV spec.

Limitations (incomplete list)

  • we don't handle If: ... headers (LOCK/UNLOCK requests are always accepted; locking is not enforced and is not functional)
  • we handle shared locks as exclusive locks
  • the failing basic.9 is new in 1.4.13 as we stripped off the fragments for clean URLs

Handle the If: header requires a parser as it contains logical expressions. To give you an overview what works and what isn't: ::

  -> running 'basic':
   9. delete_fragment....... WARNING: DELETE removed collection resource with Request-URI including fragment; unsafe
      ...................... pass (with 1 warning)
  <- summary for `basic': of 16 tests run: 16 passed, 0 failed. 100.0%
  -> 1 warning was issued.
  -> running `copymove':
   4. copy_overwrite........ WARNING: COPY to existing resource should give 204 (RFC2518:S8.8.5), got 201 Created
      ...................... pass (with 1 warning)
   9. move.................. WARNING: MOVE to existing collection resource didn't give 204
                             WARNING: Could not clean up `/litmus/movecoll'
    ...................... pass (with 2 warnings)
  <- summary for `copymove': of 13 tests run: 13 passed, 0 failed. 100.0%
  -> 3 warnings were issued.
  -> running `props':
   3. propfind_invalid2..... FAIL (PROPFIND with invalid namespace declaration in body (see FAQ) got 207 response not 400)
  <- summary for `props': of 30 tests run: 29 passed, 1 failed. 96.7%
  -> running `locks':
  18. cond_put_corrupt_token FAIL (conditional PUT with invalid lock-token should fail: 200 OK)
  22. fail_cond_put_unlocked FAIL (conditional PUT with invalid lock-token should fail: 200 OK)
  27. double_sharedlock..... FAIL (shared LOCK on locked resource: 423 Locked)
  32. lock_collection....... FAIL (LOCK on `/litmus/lockcoll/': 409 Conflict)
  -> 9 tests were skipped.
  <- summary for `locks': of 32 tests run: 28 passed, 4 failed. 87.5%

See also #1818 feature request to add RFC-compliant LOCK support to mod_webdav

Updated by gstrauss almost 3 years ago · 19 revisions