INTERNAL_IPS has issues with IPv6, IPv4
|Reported by:||narzola@…||Owned by:||peppelorum|
|Severity:||Normal||Keywords:||INTERNAL_IPS IPv4 IPv6|
|Has patch:||no||Needs documentation:||yes|
|Needs tests:||no||Patch needs improvement:||no|
This may be something that merely needs documenation.
I was having trouble with the django-debug-toolbar on my system. It would work with the debugging server (manage.py runserver ....) but not with the FCGI server (manage.py runfcgi .....). The short version of a long story is that under runserver the call to "request.META.get('REMOTE_ADDR', None)" returns an ip address that looks like "10.3.20.22" (roughly what everyone assumes it will look like). This matches one of the values I have listed in INTERNAL_IPS and the django-debug-toolbar shows up on my pages.
Under flup/FCGI, it returns "::ffff:10.3.20.22" which was not what I was expecting. It does not match the values I would ordinarily put in INTERNAL_IPS. Putting "::ffff:10.3.20.22" in my INTERNAL_IPS caused the django-debug-toolbar to work as expected under flup/FCGI.
It's a totally separate debate on whether or not IPv6 is going to replace IPv4 or when to start preparing for it. The fact is that many Linux systems, mine included, ship with IPv6 turned on and may be returning these funky "::ffff:#.#.#.#" addresses. At the very least, a clear note in the documentation would probably help other developers who are wondering why something that depends on INTERNAL_IPS works in some conditions and not in others or perhaps doesn't work at all. I think a good long term solution would be to have INTERNAL_IPS be an object that can accept IPv4 and IPv6 address and can check to see if REMOTE_ADDR is one of those addresses, reguardless of how REMOTE_ADDR is returned.
I also understand that this little probably is probably not a very high priority, but I hope that when the next developer has this problem, this bug report will come up in their search and at least they won't spend too long figuring it out.
Change History (5)
comment:1 Changed 3 years ago by lrekucki
- Component changed from Uncategorized to Documentation
- Easy pickings set
- Needs documentation set
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:2 Changed 23 months ago by anonymous
- Resolution set to invalid
- Status changed from new to closed
comment:3 Changed 23 months ago by aaugustin
- Resolution invalid deleted
- Status changed from closed to reopened
comment:4 Changed 16 months ago by peppelorum
- Owner changed from nobody to peppelorum
- Status changed from reopened to new