Monday, 10 June 2024

Bonjour

I want a solution to enable to access a webpage on a local webserver without typing an ip address or using a domain name.

Using DNS allows you to setup URLs associated with a sub-domain name, for example:
john.helliwell.org can be redirected to 192.168.0.40/home/index.html.
Although this is commonly used for internet locations, it works for local web pages as well.

Apple Bonjour provides a convenient way of accessing local devices and services without having to type in IP addresses, for example PI41.local can be used as an address for my local raspberry pi instead of 192.168.0.41.

In addition to working on Apple Bonjour (aka zeroconf, mDNSresponder, avahi) also works on Windows, Linux and on Android (version 12 and above).

I configured Avahi on my raspberry pi with an address kitchen.local

Typing "kitchen.local" in a browser now redirects to the PI41 homepage.
I actually want a specific web page when "kitchen.local" is entered.  To achieve this I configure the lighttpd web server software so that if the URL "kitchen.local" is received the user is redirected to /var/www/kitchen/index.html.
Now the user sees a web page tailored for the kitchen:


This is a simple solution to avoid using DNS redirects.  I am not sure if it will have wider uses but it could be useful to add more local addresses.

No comments:

Post a Comment