Mac OS X,  Mac OS X Server

Disabling and Redirecting CalDAV (aka Lion and Apache2)

Lion Server moves a few things around. Not only in regards to a little window dressing in the GUI apps, but also under the hood. One such example is the /ical extension often used to direct users to iCal’s little section of the web portal in OS X Server, no longer around in Lion. One could just redirect requests for /ical to /webcal as was done previously. But what if you wanted to actually redirect the CalDAV traffic to look at a directory other than /calendars on the web server (e.g. maybe your site already uses /calendars).

To do so, check out /etc/apache2/servermgr_web_apache2_config.plist. About half way down are the proxies for com.apple.webapp.webcal. Each of the directories has a path. I like to change both the name of the key and the string for the path. However, don’t change the urls key or the site will stop outputting dynamic data. Save the changes and then restart the service:

serveradmin stop web; serveradmin start web

/webcal is also defined here. So if you would prefer to use /ical then it can be changed, albeit likely breaking many of the internal links for the portal. One may be tempted to add /ical by adding an “Alias /ical /usr/share/webcal.html” line in the httpd.conf file in /etc/apache2, but that simply results in an error. So doing a redirect, as I showed previously seems to be the only way to get the response of the actual /webcal page (401 redirects do not seem to work).

Another issue that I’ve run into is getting virtual hosts to work in the first place, in order to define non-page centric forwards. This was fixed by uncommenting the following line in the httpd.conf (removing the # in front of the line):

Include /private/etc/apache2/extra/httpd-vhosts.conf

Then, you can add vhosts as usual in /etc/apache2/extra/httpd-vhosts.conf. Having said that, the only redirect I’ve gotten to work so far have been per page. I’ll likely figure out more on these subtle changes as time goes on, but more important than these specifically, hopefully this will point others to where some of these settings are stored (e.g. for webmail and other services in OS X Server). For example, let’s say you wanted to disable the web calendar and webmail altogether (for whatever reason). In that case, look for these two lines in /etc/apache2/httpd.conf (respectively):

Alias /webmail /usr/share/web/webmail.html
Alias /webcal /usr/share/web/webcal.html

Put a # in front of each to comment them out and then restarting the web service. It’s not pretty and webmail should be disabled in the Web service, but web calendars aren’t exposed in the GUI at this time and I wanted to show both. Anyway, this article is rambling on a bit like a Douglas Adams book. So, so long, and thanks for the phishing attacks!