Just another WordPress weblog

Webdav and multiviews

Fortunately the excellent KeePass password manager has the ability to store its database on a webdrive. However, since version 2.09 KeePass changed the way it saves files to such a webdrive. Instead of just saving over the old file it first creates a .tmp file that it moves to the real file after a successful save. And that’s when the problem arises.

It turns out that renaming a file from mypasswd.kdbx.tmp to mypasswd.kdbx doesn’t play nice with the apache multiviews option. When trying to save a file to the webdav location, KeePass fails with a message like:https://kerkhove.net/some_dav_location/mypasswd.kdbx
Failed to save the current database to the specified location!
The remote server returned an error: (404) Not Found.

When looking at the apache error log it logs a line like:Negotiation: discovered file(s) matching request: /var/www/path/to/some_dav_location/mypasswd.kdbx (None could be negotiated)
The solution to this problem is to disable MultiViews in the apache config. Find the part in your config that has the “Dav on” statement and add a line like:Options -MultiViews
For security reasons you may want to add “-Indexes” there as well (and of course password protect your dav space using digest authentication).