Thursday, May 22, 2008

OS X, Bonjour, Apache

As part of some experimenting the other day, I went into System Prefs on my laptop running 10.5 and activated Web Sharing. To my surprise, my personal web site did not appear in Safari's Bonjour list, nor did any HTTP service appear in Bonjour Browser. I could reach the web page if I typed in the URL, it just wasn't being advertised by Bonjour. I had a very clear memory that it used to work with Bonjour, so I started asking why it's not working now. I did some Googling, I searched Apple's support forums, I finally got my friend Thomas involved. He, also, remembered that it used to work with Bonjour, he, also, could not find any leads via Google. (And he's a really good Googler.) He suggested that we check the httpd.conf on my laptop. ("Mac use conf file? That's unpossible!") Sure enough, here's what we found:

<IfModule mod_bonjour.c>
    # Only the pages of users who have edited their
    # default home pages will be advertised on Bonjour.
    RegisterUserSite customized-users
    #RegisterUserSite all-users

    # Bonjour advertising for the primary site is off by default.

I made a trivial edit to Sites/index.html in my homedir, toggled Web Sharing off and on one more time, and presto! there was my personal site listed in Safari's Bonjour list.

I'm not sure if this is something new in Leopard, or if it changed in Tiger and I just never noticed. I'm sure Panther didn't work this way. And I'm not saying the Leopard way is bad. It just surprised me.

1 comment:

trhall said...

I think the reason they don't broadcast sites by default unless you have changed the pages is so that "default" sites (where other users on a machine don't have a web site) won't show up. That makes sense. Little Jimmy and Susie (kids) may not have sites, but Mom and Dad do. Makes good sense from a privacy/security perspective to me.

It was difficult finding the solution to this problem, definitely. We found some information on an Apple Support discussion page, but it wasn't obvious. Thanks for posting this!