Simple IP lookup service using Caddy
Running Caddy? Add this for an easy no-frills IP lookup service.
http://ip.ch10.nl, https://ip.ch10.nl {
log
templates
respond "{{.RemoteIP}}
"
}
Then using e.g. curl:
$ curl ip.ch10.nl
10.1.2.3
Without the explicit http and https URL in the Caddyfile, caddy will
redirect http to https which is fine in the browser but annoying for a
quick curl command. You would just get a 302 response and no output. You
can add -L
but that's just annoying!
$ curl ip.ch10.nl
$ curl -L ip.ch10.nl
10.1.2.3
🗣 Comments