Return Client IP Address As Plain Text

In Caddy Server, we can use Template(s) to return Client IP Address as plain text, using .RemoteIP, Caddyfile example is given below -

Caddyfile:

example.com {
    templates
    header Content-Type text/plain
    respond "Hello from IPv6, your IPv6 is -> {{.RemoteIP}}"
    encode zstd gzip
}

Source: Caddy Community

Last updated