In this post I will describe how you can enable write access to a file, specially a RDF one, via Apache’s HTTP server and the Web Distributed Authoring and Versioning protocol (WebDAV) extension to the HTTP protocol.

So, why would you want to do this?

I use WebDAV on my FOAF file to enable write access via Tim Berners-Lee’s Tabulator and Garlik’s foafbuilder. This technology allows me to write updates straight through the HTTP protocol, so that I don’t have to save the file to my local machine, and scp it over.

These are the configuration settings needed in your httpd.conf file:

Setting up WebDAV on a whole directory:



<VirtualHost *:80>

ServerName www.foo.com

ServerAlias foo.com

Alias / /var/www/foo/public_html/

<Location />

DAV On

AuthType Basic

AuthName “webdav”

Header set MS-Author-Via DAV

AuthUserFile /var/www/foo/passwd.dav

<LimitExcept GET HEAD OPTIONS POST>

Require user bar

</LimitExcept>

</Location>

</VirtualHost>

Enabling WebDAV for all files ending in .rdf:



<VirtualHost *:80>

ServerName www.foo.com

ServerAlias foo.com

Alias / /var/www/foo/public_html/

<Files ~ “.*\.rdf”>

DAV On

AuthType Basic

AuthName “webdav”

AuthUserFile /var/www/foo/passwd.dav

Header set MS-Author-Via DAV

ForceType application/rdf+xml

<LimitExcept GET HEAD OPTIONS POST>

Require user bar

</LimitExcept>

</Files>

</VirtualHost>

It should be noted that the methods presented above allow for the files to be read normally via HTTP, as well as catering for writing via WebDAV.

WebDAV related HTTP Headers:

The correct HTTP header used to tell a client that a file is WebDAV enabled is:

MS-Author-via: DAV

Some of this information was taken from the ESW wiki’s article “EditingData”, and I should thank everyone who helped put it together.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.