A very simple service that shows your public ip address. You can test it on heroku. Ipz can also return your ip and hostname (if applicable) in JSON format.
Ipz can be installed using npm:
$ npm install ipz
Using CURL:
$ curl -X GET -H "Accept: application/json" http://ipz.herokuapp.com/
will respond with:
{"ip": "your ip here"}
or:
{
"ip": "79.167.55.15",
"hostname": "foo"
}
Sample configuration using nginx. It assumes that the application listens on port 8080.
server {
listen 80;
server_name ip.example.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
}
}
See ipz.service
in the systemd folder.
See LICENSE
.
Tasos Latsas