Improves retrieving IP address when not specified in URL

* Fix IPv6 bug #8
* Add support for X-Forwarding-For and X-Real-IP headers #7