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

IPv6 in X-Forwarded-For fix #6062

Merged
merged 2 commits into from Aug 9, 2019

Conversation

@davidfischer
Copy link
Contributor

commented Aug 9, 2019

It's unclear to me whether our production proxies would ever include an IPv6 with port. In the errors I'm seeing in prod, I don't see that. X-Forwarded-For is not exactly a standard so there isn't something to look up here.

davidfischer added 2 commits Aug 9, 2019

@davidfischer davidfischer requested review from dojutsu-user and readthedocs/core Aug 9, 2019

@dojutsu-user
Copy link
Member

left a comment

Looks good.

# only client's ip is present
request = RequestFactory().get('/')
request.META['HTTP_X_FORWARDED_FOR'] = '203.0.113.195'
client_ip = get_client_ip(request)
self.assertEqual(client_ip, '203.0.113.195')

# only client's ip is present
request = RequestFactory().get('/')
ip = '2001:abc:def:012:345:6789:abcd:ef12'

This comment has been minimized.

Copy link
@dojutsu-user

dojutsu-user Aug 9, 2019

Member

Where did you get the sample ip?

This comment has been minimized.

Copy link
@davidfischer

davidfischer Aug 9, 2019

Author Contributor

I just created it. You can always test if it's a valid IP (it is) with the ipaddress module.

@ericholscher

This comment has been minimized.

Copy link
Member

commented Aug 9, 2019

Hotfixed to rel.

@davidfischer davidfischer merged commit e53af66 into master Aug 9, 2019

3 checks passed

continuous-documentation/read-the-docs Read the Docs build succeeded!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
pyup.io/safety-ci No dependencies with known security vulnerabilities.
Details

@davidfischer davidfischer deleted the davidfischer/ipv6-fix branch Aug 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.