I remember this conversation.
Caddy 2.6.0 works with a Caddyfile like this.
Caddyfile
server.example.com header Content-Type text/plain respond "{{.RemoteIP}}" templates