Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix getting client's ip address from behind of proxies #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dimitry-lzs
Copy link

@dimitry-lzs dimitry-lzs commented Jan 10, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant