Apple’s mod_bonjour is broken in Snow Leopard, so I fixed it.

I was playing about with Apache on my iMac and I noticed a little file tucked away in /etc/apache2/other called bonjour.conf.  Intrigued I set about figuring out what it was for.

This file had some directives relating to an Apache module called mod_bonjour.  The purpose of which is to register URLs with Apple’s Boujour service.  This service lets systems and services publish their existence on a local area network so other systems and applications can find them without configuration.  Boujour is just Apple’s marketing speak for Zeroconf style networking.  It is also known as multicast DNS and is common on Linux and Apple systems.

Safari on MacOS even has a Bonjour menu that displays services or devices that are advertising themselves via the Bonjour service.  An example of this is my QNAP NAS.  I can always easily access the Admin interface of my NAS (and other services the NAS provides) because it advertises itself with Bonjour.

I thought that using Bonjour would be rather handy for advertising some web applications I had configured on my iMac to other systems on my home network.  So I added them to the bonjour.conf configuration file like so:

RegisterUserSite customized-users
RegisterResource “Confluence” “/confluence”
RegisterResource “TeamCity” “/teamcity”

Unfortunately after restarting Apache I was dismayed to discover that only the last RegisterResource directive seemed to be working (TeamCity), as it was the only resource showing up in the Bonjour menu in Safari.

However after a quick search for mod_bonjour with Google I discovered two posts detailing the problem.  There is a bug in mod_bonjour.

Joe Maller found the bug and supposedly reported it to Apple in 2007, and Chuck Houpt even created and released a patch for the Leopard release of Mac OS X.

Now I’m running Snow Leopard so I didn’t want to just use the patched binary Chuck provided, so I set about patching the Snow Leopard version of this module.  Fortunately Apple provide the source code to this module on their open source site.  So I took what appears to be the code from Snow Leopard, applied Chuck’s patch and produced a version for Snow Leopard.

In order to share this updated code with the wider Internet I’ve created a GitHub code repository for it.  In order to build this code and update your Mac you will need the Apple Developer Tools installed.

Advertisements

4 thoughts on “Apple’s mod_bonjour is broken in Snow Leopard, so I fixed it.

  1. Hi, thanks for this patch. I’m going to try to use it, although it stills not so clear to me how to configure Bonjour to let it work in conjunction with Apache Virtual hosts.
    Let’s say we have made a virtual host called foo.local which points to /Users/foo/Sites/thefoopress/ and it was configured on port 80. How do we configure Bonjour?

    RegisterResource "foo.local" /Users/foo/Sites/thefoopress/

    or

    RegisterResource "foo.local" foo.local:80

    or what else?

    Thanks for any suggestion

    • I’ve not used the module with VirtualHosts so I’m afraid I can’t suggest a solution.

    • @orj: Never mind. I’ve already setup everything and it’s working like charm.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s