This is a simple serverside/serverless JavaScript website to plainly present the IP-Address of the visitor. It's made specifically to work on Cloudflare Workers Sites. The website itself doesn't need JavaScript to be enabled on the client. But having clientside JavaScript enabled adds an easy "Copy to Clipboard" function. The site is styled with pure CSS, using W3.CSS.
- 💖 Not commercial, no ulterior motives 💖
- ❌ No Ads
- ❌ No Tracking
- ❌ No unnecessary Logs
- ❌ No other unnecessary information
- ✅ Absolutely free to use
- ✅ Open Source - feel free to host it yourself and change according to your needs
- ✅ IPv4 and IPv6 support
- ✅ Simple, clean and responsive layout
- ✅ Works without (client-side) JavaScript
You can selfhost this project on Cloudflare Workers, which is free 🥰 for upto 100,000 requests per day.
The source code consists of 2 main folders:
- public/ - contains the mostly static portions aka "the site"
- workers-site/ - contains the JavaScript application as index.js
The magic is happening in getClientIPInfo(request)
. Cloudflare is providing informations like visitor IP-Address and location and we can easily use it.
// get country from cloudflare
let location = (request.cf || {}).country
// if we know which city, prepend to location
if((request.cf || {}).city) {
location = ((request.cf || {}).city)+', '+location
}
// [...]
/* get client ip address by Cloudflare header 'CF-Connecting-IP' */
ipaddress: request.headers.get('CF-Connecting-IP')
Since Cloudflare Workers has no method to force IPv4 or IPv6 usage, I've put a small PHP script on another webhost. The webhost is reachable with dedicated hostnames for IPv4 and IPv6. The script is just outputting the IP-Address of the client. The website fetches the info from the PHP script using client-side JavaScript/AJAX. So if the website visitor has JavaScript disabled, the site will only show the primary IP-Address determined by Cloudflare.
Status | Branch | Note |
---|---|---|
main | Release/live version | |
dev | Development version |
This project is licensed under the terms of the MIT license.