Getting Cyrus CalDAV to work with Evolution

Bugs in the Spec are the most expensive

When upgrading to Debian Jessie I discovered that our Cyrus mailer now supports CalDAV. This was easily installed. The cyrus server did have a self signed certificate anyway, so all there was to do was to apt-get install cyrus-caldav and to uncomment the https line in cyrus.conf. Since I use basic authentication http is not an option.

Configuring Evolution

Configuring Evolution was not as easy as claimed in the otherwise highly useful documentation. Calendar auto detection requires more than just the server name. This is what works:


After finding this Evolution could read the calendar, but complained about it being read only when trying to add an appointment. It seems that Evolution considers a the calendar read only if it does not announce PUT. The hard question is, if that is correct. Unfortunately RFC 2518 is missing a section “OPTIONS for collections”. I could not find any specification that says, wether announcing PUT for a collection as Evolution expects it is correct.

Apaches mod_dav at least does not announce PUT for collections.

if (!resource->collection)
    apr_table_addn(methods, "PUT", ""); 

Apache to the rescue

Apache actually has what it takes to work around this. So I am now running cyrus http on localhost

# Only localhost is allowed unencrypted
http            cmd="httpd -U 30" listen="localhost:8008" prefork=0 maxchild=100

and proxying it through an Apache virtual host

Listen 8443

<VirtualHost *:8443>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/html

    ProxyPreserveHost On
    ProxyPass "/" "http://localhost:8008/"
    ProxyPassReverse "/" "http://localhost:8008/"

    # This avoids 408 + 502 errors.
    # Seems that cyrus HTTP 1.0 is not net 100% correct
    SetEnv force-proxy-request-1.0 1
    SetEnv proxy-nokeepalive 1

    BrowserMatch    Evolution                       fake-write-coll
    SetEnvIfNoCase  Request_Method "^OPTIONS$"      is-options
    SetEnvIf        is-options "^$"                 !fake-write-coll
    <Location /dav/calendars/user/*/Default/>
        Header append Allow "PUT, DELETE" env=fake-write-coll
    <Location /dav/addressbooks/user/*/Default/>
        Header append Allow "PUT, DELETE" env=fake-write-coll

    ErrorLog ${APACHE_LOG_DIR}/
    CustomLog ${APACHE_LOG_DIR}/ mh

    #   SSL Engine Switch:
    #   Enable/Disable SSL for this virtual host.
    SSLEngine on

    #   SSLCertificateFile directive is needed.
    SSLCertificateFile      /etc/ssl/certs/cyrus.pem
    SSLCertificateKeyFile   /etc/ssl/private/cyrus.key


to add PUT and DELETE for the calendar collections. Note that this workaround lets Evolution display all calendars as writable, no matter what their actual status is.