Bonjour / mDNS / ZeroConf support in App::HTTPThis

App::HTTPThis can advertise your local web server on your network so other devices can find it without you having to tell them an IP address and port.

This document explains the what, the how, and the how do I check it’s working?


1) What is Bonjour / Rendezvous / mDNS / ZeroConf / Avahi?

The 30‑second version

So when people say “Bonjour” (or “Rendezvous”, “mDNS”, “ZeroConf”, “Avahi”), they’re usually talking about the same family of technologies: advertise a service on the local network and let clients discover it automatically.

What it does for App::HTTPThis

When you start http_this with a name, it can publish a service of type:

$ http_this --name MyService .

That means other machines on the same network that speak mDNS/DNS‑SD can discover something like:

(Exact details depend on your network and how many interfaces you have.)


2) How do I use it with http_this?

Basic usage

Start the server and publish it via mDNS/DNS‑SD:

http_this --name MyService

What Perl modules do I need?

Publishing is implemented via Net::Rendezvous::Publish.

You will also need an appropriate backend module for your platform, typically:

In other words:

Notes and gotchas


3) How do I see my advertised service?

Option A: Avahi tools (Linux)

If you’re on Linux with Avahi installed, you can browse all advertised services:

avahi-browse -at

You should see entries like:

To filter to HTTP services only:

avahi-browse -rt _http._tcp

Option B: A graphical browser

On many platforms there are “Bonjour browser” apps that show advertised services. These are handy for a quick sanity check.

(Any mDNS/DNS‑SD browser should work — you’re just looking for _http._tcp with the instance name you chose.)

Option C: Discover from Perl

To discover services from Perl, use Net::Bonjour.

Net::Bonjour can browse and resolve services to host/port information.

A minimal example (adapted from the Net::Bonjour documentation):

use strict;
use warnings;

use Net::Bonjour;

my $browser = Net::Bonjour->new('http');
$browser->discover;

for my $service ($browser->services) {
  $service->resolve;
  next unless $service->name; # defensive
  printf "%s %s:%s\n",
    $service->name,
    ($service->addresses)[0] // 'unknown',
    $service->port // 'unknown';
}

If you started:

http_this --name MyService

…you should see output that includes something like:

MyService 172.24.198.3:7007

Interpreting what you see


Troubleshooting


Further reading

(If you find anything unclear or you have platform-specific notes to add, please open an issue or PR.)