GithubHelp home page GithubHelp logo

Comments (5)

un33k avatar un33k commented on September 26, 2024

@shadinaif Version 1 was simple and just wanted to get your the first routable IP address it found so users could identify clients uniquely.

Version 2 on the other hand, allows the advanced users to pass in the trusted proxies, the number of proxies as well as a custom right-most flag, as per their network configuration.

The default behavior is to find the left-most ip address for HTTP_X_FORWARDED_FOR OR X_FORWARDED_FOR and if that IP is not routable, it will go down the IPWARE_META_PRECEDENCE_ORDER to find the best routable IP address.

As for HTTP_X_FORWARDED_FOR OR X_FORWARDED_FOR, if the left most IP address is not routable, it cannot be client's read IP address, so it skips over to find the next routable IP.

SemVer was update to 2.0 indicating a backward incompatibility.

Feel free to switch to version two.

Closing the issue, but feel free to reopen if you feel that you have found a bug in version 2.

from django-ipware.

shadinaif avatar shadinaif commented on September 26, 2024

Thank you @un33k 👍

from django-ipware.

kleptog avatar kleptog commented on September 26, 2024

The above explanation is a bit incomplete. If I read the code right, it stops on the first public IP, so if you are coming from a local private network, then get_client_ip will return based on the lowest priority header. Not necessarily a problem, but not an obvious change from the previous version.

Just had to fix our test cases :)

from django-ipware.

un33k avatar un33k commented on September 26, 2024

@kleptog Moving from 1.x to 2.x was a breaking change and the behavior changed as well. Therefore your test cases that were for 1.x needed to also changed. Hope this helps,

from django-ipware.

un33k avatar un33k commented on September 26, 2024

@kleptog django-ipware is on its way to being deprecated.

With that said, I have a python package that is going to replace it.

Have a look at python-ipware and if works for you switch to it.

Feedback is welcomed.

from django-ipware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.