Creating a "What Is My IP" website in four lines with nginx
I recently wanted to create an endpoint on a development machine that could return my external IP address. Normally I would use one of a handful of services https://canhazip.com/ or https://ifconfig.ca/, but I wanted to see how easy it would be to make my own. As it turns out, it's incredibly easy, and doesn't even require leaving the reverse proxy.
Using nginx, we can just create a block like this.