This file is also available in Italianβ .
A minimal web service that returns the client's public IP address. It replicates the behavior of https://checkip.amazonaws.comβ , but is self-hosted and containerized.
CF-Connecting-IP (Cloudflare)X-Real-IP (reverse proxy)X-Forwarded-Forrequest.remote_addr.ico (or disable it if you prefer)/debug endpoint (Basic Auth + env-gated)/info endpoint (to open ipinfo.io and read more information about your detected IP address)ProxyFix)docker run -d -p 80:8080 gfsolone/ip:latest
or using GHCR:
docker run -d -p 80:8080 ghcr.io/gioxx/ip:latest
Then visit: http://localhost
Or run: curl http://localhost
Tip: prefer a fixed tag (e.g.,
:1.0.0) or a digest over:latestfor reproducible deployments.
Find the ready-made file here: docker-compose.ymlβ
version: "3.8"
services:
ip:
image: gfsolone/ip:latest
ports:
- "80:8080"
restart: unless-stopped
You can find the ready-made file here: docker-compose-env.ymlβ , you just have to remember to create the .env file (or use Portainer's env or whatever other product you are using), and finally rename this file to docker-compose.yml
version: "3.8"
services:
ip:
image: gfsolone/ip:latest
ports:
- "80:8080"
env_file:
- .env
restart: unless-stopped
.env example:
ENABLE_DEBUG=false
DEBUG_TOKEN=change_me
Using GHCR instead of Docker Hub? Replace the image with
ghcr.io/gioxx/ip:latest(or a pinned tag).
Environment variables:
ENABLE_DEBUG (true/false)/debug endpoint only when set to true.DEBUG_TOKEN/debug (username is always debug).Reverse proxy:
ProxyFix (see comments in app.py) so remote_addr and host/port are set correctly by proxy headers.Favicon:
/favicon.ico to a GitHub-hosted .ico and advertises it via a Link header from /.https://raw.githubusercontent.com/gioxx/curl-ip/<commit_sha>/favicon.ico204 No Content and long cache.GET /
Returns the client IP as text/plain; charset=utf-8. Adds Link: </favicon.ico>; rel="icon".
GET|HEAD /favicon.ico
308 Permanent Redirect to the GitHub-hosted icon. Long cache (Cache-Control: public, max-age=31536000, immutable).
GET /debug
Returns selected request headers and resolver info only if:
ENABLE_DEBUG=true, andusername: debug, password: $DEBUG_TOKEN).Extra:
Via browser, by pointing to the endpoint /info, you will be redirected to https://ipinfo.io/what-is-my-ipβ to obtain more information about the detected IP.
$ curl http://localhost
203.0.113.42
A public demo endpoint is available at: https://ip.gioxx.org/β
Note
**Heads-up:** this is hosted on a Raspberry Pi at home (best-effort availability). It may be temporarily unreachable, **please donβt rely on it for production**. The endpoint behaves like this service: it returns the client's IP as plain text.
MIT License β do whatever you want, but keep the credits π
Feedback, suggestions, and pull requests are welcome!
Feel free to open an issueβ or contribute directly.
Content type
Image
Digest
sha256:326b16514β¦
Size
43.2 MB
Last updated
11 months ago
docker pull gfsolone/ip