MHN
Add a comment on Hacker News →
6 of 196 comments
  1. You might check out .internal instead which was recently approved [1] for local use.

    [1]: https://en.wikipedia.org/wiki/.internal

    1. The *.home.arpa domain in RFC 8375 has been approved for local use since 2018, which is long enough ago that most hardware and software currently in use should be able to handle it.

      1. Why use that over *.localhost which has been available since 1999 (introduced in RFC 2606)

  2. Thanks for sharing!

    This is cool, but it only seems to work on the host that has the /etc/hosts loopback redirect to *.localhost. I run my app on a home server and access it from multiple PCs on the LAN. I have several apps, each associated with a different port number. Right now, I rely on a start page (https://github.com/dh1011/start-ichi) to keep track of all those ports. I’m wondering if there’s an easy way to resolve custom domains to each of those apps?

  3. It's easy with Caddy to setup it in a way that you can have your api and SPA app in under the same domain in order to avoid CORS-issues.

    myapp.localhost {
    tls internal

        # Serve /api from localhost:3000 (your API)
        @api path /api/*
        handle @api {
            # Remove the leading "/api" portion of the path
            uri strip_prefix /api
            reverse_proxy 127.0.0.1:3000
        }
    
        # Fallback: proxy everything else to Vite's dev server on 5173
        handle {
            reverse_proxy 127.0.0.1:5173
        }
    }

    You're welcome.

  4. I have a small go binary that uses caddy and dns-sd on mac to have any kind of domain names on my local network (uses mdns) with https. Really nice for accessing websites from my phone.

    https://github.com/DeluxeOwl/localhttps