Wednesday, August 17, 2011

Setting Up WebDAV on Mac OSX Snow Leopard

After trying out several how-to's at various blogs, I finally was able to find one that "almost" worked.  I probably should mention that the first few tutorials I went through would have worked had I not misspelled a directory in the configuration file causing it not to be accessible.  The post below worked except the configuration for the httpd-dav.conf was slightly incorrect.  It shows "Dav On" outside of the <Directory> block, but should be inside the block.  After that everything worked.

http://geekfactor.charrington.com/2009/12/run-a-webdav-server-on-your-mac-to-sync-voodoopad-for-free

The setup that I was trying to achieve is for any user to be able to have read-only access to the WebDAV folders, but requires a valid user(one that is configured in the password file) in order to modify or delete anything.  To accomplish this a couple updates were required in the httpd-dav.conf in /etc/apache2/extras.

1. Add a LimitExcept block in the top level WebDAV directory.
    <LimitExcept GET OPTIONS PROPFIND>
        Require valid-user
    </LimitExcept>

What the above block will do is only allow guests to view the files and directories via a web browser and also connect to the WebDAV directory as a drive/folder.  The LimitExcept block disallows all HTTP command except the ones listed unless the user is valid and authenticated.

2. Add Options for Index

    Options +Indexes
    IndexIgnore ..
    IndexOptions -IconsAreLinks NameWidth=* FancyIndexing SuppressLastModified FoldersFirst
    IndexOrderDefault Ascending Name

The options above allow the files/directories to be seen via a web browser.

Update: WebDAV does not seem to work correctly in Windows 7.  A WebDAV client such as BitKinex is required.