Joe Maller.com

Multiple RegisterResource directives broken in Leopard

This is sort of a follow up on the old mod_rendezvous article I wrote for O’Reilly. While cleaning up my virtual hosts I discovered a bug in 10.5’s handling of multiple RegisterResource directives in mod_bonjour. This is expanded from a bug report I submitted to Apple (rdar://problem/5628484).

I keep functional mirrors all my development sites in separate Apache Virtual Hosts. Each one then gets it’s own port, which allows me to check them on local networks, in Parallels and, if I want, remotely via IP address.

To advertise two local vhosts over bonjour, something like this in httpd.conf should work:

<IfModule bonjour_module>
RegisterResource "Site 1" / 9001
RegisterResource "Site 2" / 9002
</IfModule>

After restarting Apache (sudo apachectl graceful), local copies of Safari should see the two sites, “Site 1″ and “Site 2″ in Bonjour bookmark listings. In 10.4, they show up. In 10.5, only “Site 2″ shows up. No matter how many directives are included, only the last one will be visible.

I’d love to be wrong about this, but it seems that something broke this function in Leopard.

A faster way of checking Bonjour entries is to open a terminal window and run the following command:

mdns -B _http._tcp

That will show a live updating list of current multicast (Bonjour) entries. Under 10.4, I get the following after adding the above directives to httpd.conf:

16:10:14.517  Add     0 local.     _http._tcp.     Site 1
16:10:14.667  Add     0 local.     _http._tcp.     Site 2

However with 10.5, I get this:

16:12:52.597  Add     1 local.     _http._tcp.     Site 2
16:12:52.598  Add     1 local.     _http._tcp.     Site 2
16:12:52.598  Add     0 local.     _http._tcp.     Site 2

What I’d really love to do is figure out how to register and respond to multiple Bonjour names. That way I could have each vhost be a named host and each staged site accessible at a url like site1.local and site2.local. So far I haven’t had any luck getting that working.


  • http://www.whoisgregg.com/blog/ Gregg Hilferding

    Glad I found this followup. Might be a good idea to do an update of the old article, even if all you change is rendezvous to bonjour. ;)

    I have also done a lot of research into broadcasting site1.local, site2.local, etc. with no luck. Happy to see I’m not the only person out there who thinks such a scheme would make a lot of sense.

  • http://avit.ca Andrew Vit

    Ditto. I just assumed this would “just work” and I struggled until I found this. Too bad. I have my virtual hosts all on *:80, and somehow i thought the name parameter referred to the ServerName of the vhost, but I now see it’s just a text label, not a hostname… too bad.

  • http://test testing

    {$

  • http://habilis.net/chuck/ Chuck Houpt

    As a stop-gap, I’ve created a patch/build of mod_bonjour which corrects the multiple RegisterResource problem:

    http://habilis.net/mod-bonjour-fix/

  • http://www.joemaller.com Joe

    Chuck, that is just flipping awesome. I’ll give it a try later tonight.

  • Brandon

    Great posts (both here and on O’Reilly.)

    Any luck with getting mod_bonjour to work with named vhosts?

    There also appear to be two versions of mod_bonjour on Apple’s site: http://www.opensource.apple.com/source/apache_mod_bonjour/

  • http://deeperdesign.com Oliver Jones

    It seems that Snow Leopard still contains this bug.

    From the look of things http://www.opensource.apple.com/source/apache_mod_bonjour/apache_mod_bonjour-12/
    is the version included with Snow Leopard.

    I’ve patched this version and created a GitHub project for it here:
    http://github.com/orj/mod_bonjour

  • http://crashplan.probackup.nl/ Pro Backup

    In Mac OS X 10.6.5 the Apache mod_bonjour is still no fixed by Apple for multiple resource registrations.

    Multiple RegisterResource declarations result in only the last being registered in _http._tcp. mDNS.

  • Will

    Looks like it’s fixed in Lion fyi, or at least 

    • Will

      for me :-)