Is it possible to whitelist hosts in Caddy 2? Perhaps with IP filter?
With the Caddyfile, Caddy does it automatically. It only serves HTTP requests which have a Host header matching what you specify as your site address in the Caddyfile.
You can also filter requests by client IP, if you want, but it sounds like you’re asking about the Host header.