UPDATE 2 4/8/2012: It’s been a year and a half (almost), but Apple finally fixed CalDAV SRV record discovery in, I believe, iOS 5.0.2 (and therefore 5.1). So all of this is now completely valid, and supported by Apple (finally)!
UPDATE 12/18/2010: It’s taken me a bit to post this (sorry), but I can say that iOS 4.2.1 (the released version of 4.2) supports discovery of CardDAV servers over SRV records. However, CalDAV does NOT work. I’ve been told by people in the know that it’s coming, it just didn’t make it into 4.2.1. Now, I have no idea why… one would think it’s the same back-end, but who knows. Anyway, CardDAV works, CalDAV doesn’t, but hopefully 4.3 (or whatever they call it) will fix that.
Part of being a systems administrator is making the life of your customers easier. Whether it’s having a file share auto-mount when they login, having to only remember a single password (or just having to login once via SSO), or in this case, not having to remember what server provides what services. So, over the past few days I’ve been playing with autodiscovery of CalDAV and CardDAV for Mac OS X and iOS.
Address Book and iCal in 10.6 use SRV records nicely. If I tell iCal that my server is www.example.com, and I have an SRV records that say:
_caldav._tcp.www.example.com. 86400 IN SRV 0 0 8008 caldav.example.com.
_caldavs._tcp.www.example.com. 86400 IN SRV 0 0 8443 caldav.example.com.
iCal magically figures out that my actual caldav server is caldav.example.com (it defaults to lookup caldavs first, then caldav if caldavs isn’t available). I have a similar SRV record set up for CardDAV: