[mod_python] mod_python, WebDAV and dynamic VirtualHosts

Patrick Coleman blinken at gmail.com
Mon Oct 10 22:23:43 EDT 2005

I'm currently looking for a way to define a python request handler to
process incoming requests and enable WebDAV on certain directories.
The reason I want to use python for this is because I need a 'Mass
VirtualHosting' arrangment, where virtualhosts are dynamically handled
depending on the Host: header, and so I dont think (please correct me
if I'm wrong) its possible to do this (ie. enable WebDAV on a specific
directories inside a dynamic VirtualHost) with plain Apache config.

I am currently achieving the virtualhosting side of things by using
mod_vhost_alias which is working nicely, but I would like to setup a
system where users can access their web directory over WebDAV using
the URL http://a.users.hostname/dav.

For this specific example, something like this would work (havn't
tested it but you get the general idea):
<VirtualHost *:80>
  ServerName a.users.hostname
  Alias /dav /www/domains/a.users.hostname
  <Location /dav>
    DAV On
    AuthType "Basic"
    AuthName "a.users.hostname WebDAV"
    AuthUsersFile /www/domains/a.users.hostname/passwd/htpasswd
    Require valid user

This would be great except that I need it created dynamically somehow
- as a last resort I could fall back on creating all these sections by
hand for each user, but that solution doesnt seem as elegant somehow

Hence mod_python. A request handler seems to do what I want, but I'm
not sure how to set options like 'DAV On' (or do aliases) as
appropriate for certain directories. Is this possible, or should I be
looking at some other solution?

I hope all that made sense, and wasnt too long-winded :)
Thanks in advance,

More information about the Mod_python mailing list