A Cloudflare Worker that provides IP address information, including RDAP data and ISP details.
This documentation assumes you will want to deploy your own to Cloudflare account, but the worker is deployed at https://myip.badsector.dev for anyone to use.
- Get client IP address in plain text
- Get ISP name in plain text
- Live Cloudflare data (IP, ISP, location)
- Cached RDAP lookups with 2-week expiration
- Cache invalidation options
Returns the client's IP address in plain text.
curl https://your-worker.dev/ipReturns the client's ISP name in plain text.
curl https://your-worker.dev/ispReturns detailed JSON information including:
- IP address (live)
- ASN (live)
- ISP (live)
- Geographic location (live)
- RDAP data (cached)
- Abuse contact info
curl https://your-worker.dev/The worker only caches RDAP (Registration Data Access Protocol) lookups, as these are external API calls. All Cloudflare data (IP, ISP, location) is always fresh from the request.
- RDAP data is cached for 2 weeks
- All other data is live
- Query Parameter -
?nocache
curl https://your-worker.dev/?nocache- Bypasses the RDAP cache for a single request
- Forces fresh RDAP lookup
- Doesn't affect future requests
- Invalidate Cache for an IP
curl -X POST https://your-worker.dev/invalidate \
-H "Content-Type: application/json" \
-d '{"ip": "8.8.8.8"}'- Removes cached RDAP data for specific IP
- Forces next request to fetch fresh RDAP data
- Natural Expiration
- RDAP cache entries automatically expire after 2 weeks
- No manual intervention needed
- Cache keys format:
rdap:${ip} - Caches stored in Cloudflare's Edge Cache
- Only RDAP responses are cached
- All other data is real-time from Cloudflare
- Install dependencies:
npm install- Run locally:
npm run dev- Deploy:
npm run deploy- First request for an IP fetches and caches RDAP data
- Subsequent requests use cached RDAP data
- Use
?nocachewhen testing or verifying RDAP data - Use
/invalidatewhen you need to force fresh RDAP data for an IP - All Cloudflare data is always fresh
MIT