Serve dynamically-generated content that “feels” static
Any examples of how one could implement something like “what is my ip” that would just return the IP address of the client connecting to Caddy?
For bonus points, something more complicated that can handle proxying via Cloudflare and instead extract the IP from the HTTP_CF_CONNECTING_IP header and also do a reverse DNS lookup on the IP to show the DNS name too.
I know how to do all of the above with PHP and php-fpm, but I’m wondering whether it can be done in a simpler way just with Caddy which would make it much easier to just move it from server to server.
In order to make routing/handling decisions? You’re looking for matchers which already exist. There are matchers for headers, I don’t know about reverse DNS though because that’s extremely slow in terms of HTTP requests (you’d have to do DNS lookups…) so maybe someone has written a plugin to do that but that’s probably where you’d have to look.
What is the easiest way to invoke dig +short -x <ip> from Caddy, or another external script, e.g. bash script? Or is fastcgi the way to do it? This is more of an educational question, not for a high volume site, etc. we can ignore the performance aspects of starting a new process per request.