fix getting client's ip address from behind of proxies #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using this library for clients fingerprinting I stumbled upon an issue in which hash I was using to identify clients was different on every request. Trying to figure out what the problem was, I quickly looked through source code and figured out which IP address was chosen first from request object for geoIP lookup, which was the last one in list of X-Forwarder-For header. Searching more info on regard of content of this header I stumbled across this Mozilla Developers breakdown of header X-Forwarded-For: , , . I realized that instead of taking client's actual IP address library was passing CloudFlare's last CDN's IP address to geoIP lookup, and considering that they use load balancers, this last IP address was different each time.
Long story short, this pull request fixes getting load balancer's IP address instead of client's IP by replacing
pop() with [0] on array of IP addresses.