DEV Community

Doni Leong
Doni Leong

Posted on

I was tired of ad-filled "What is my IP" sites, so I built an open-source one with Cloudflare Workers

Whenever I turn on a VPN or switch proxy setups, I always want to double check my IP address and make sure my traffic is actually routing where it should be.

Every time I google "what is my IP", the first few results are always full of annoying banner ads, slow popups, and tracking scripts. Even worse, most of them only check one single database, and half the time the location is totally wrong or outdated.

So I decided to build a simple, clean tool for myself: My-IP-Info.

It is completely open source, has zero ads, and does a few things I really needed that most other sites don't do.


1. Comparing Multiple IP Databases At Once

One thing I learned while building this is that IP geolocation databases disagree with each other all the time. One provider might say you are in Los Angeles, while another says San Jose, simply because your ISP routes traffic through a regional hub.

Instead of trusting just one source, the app sends parallel requests to several independent providers:

  • Cloudflare Trace
  • IPify
  • IP.SB
  • IPWhoIs
  • IPIP.net

Then it pins all the different coordinates on an interactive map. This makes it super easy to see if providers agree on your location or if your ISP has conflicting data.


2. Checking For Real Leaks (WebRTC & DNS)

Just because your browser shows a proxy IP doesn't mean your real connection is hidden. There are two sneaky ways your real network can leak:

WebRTC STUN Leak

Browsers use WebRTC for peer-to-peer video and audio. When setting up a connection, the browser talks to a STUN server to find your public and local network interfaces.

If your VPN doesn't block this properly, your real home IPv4 or IPv6 address gets handed out directly. In the app, I use RTCPeerConnection to gather these ICE candidates and warn you if the STUN public IP doesn't match your HTTP IP.

DNS Leak (The Random Subdomain Trick)

You cannot directly ask JavaScript in a browser "Hey, which DNS server am I using?" because the browser sandbox blocks raw socket access.

To test for DNS leaks, the app uses a clever trick:

  1. It requests a random test ID like x9a7b2.
  2. It makes 10 fast fetch requests to random subdomains like 1.x9a7b2.bash.ws, 2.x9a7b2.bash.ws.
  3. Because these subdomains never existed before, no DNS server has them cached. Your computer is forced to ask its real configured upstream DNS resolver to go find the answer.
  4. The authoritative server captures which IP made that DNS query and reports it back.

If your proxy is set to Japan, but the DNS resolver IP belongs to your local internet provider back home, then you know your DNS is leaking.


3. The Architecture (Zero Hosting Costs)

I wanted something fast with zero maintenance and zero server costs, so I deployed the whole project as a unified Cloudflare Worker:

  • Frontend: React 18, TypeScript, Vite, and Leaflet for the map.
  • Backend: Hono running on the Cloudflare edge.

Cloudflare Workers has a feature called env.ASSETS. When a browser visits the root URL, Cloudflare serves the static React single-page app from its edge cache.

Bonus: Terminal / cURL Friendly

If you request the exact same URL from your terminal with curl, the Hono server checks the User-Agent header. Instead of returning the React HTML, it returns just your clean public IP with a newline:

curl https://my-ip-info.ii2d-dev.workers.dev
Enter fullscreen mode Exit fullscreen mode

You can also ask for JSON or YAML with ?format=json or ?format=yaml.


4. Installed As An iPhone App (PWA)

I also configured it as a Progressive Web App (PWA). I added it to my iPhone home screen using Safari's "Add to Home Screen".

Now it opens up full screen just like a native app with no browser address bar. Whenever I switch Wi-Fi or turn on my VPN, I just tap it once and check my status in one second.


Links & Code

The project is licensed under MIT. You can also self-host your own instance on your own Cloudflare account by running pnpm deploy.

I would love to hear any feedback or ideas on other network checks I should add. Thanks for reading!

Top comments (0)