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

Use last forwarded IP #68884

Merged
merged 2 commits into from
May 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update test with new behavior
  • Loading branch information
ryanhiebert authored Apr 16, 2024
commit d07bd55634746ce14ba4f950db2ec4730afdadd5
6 changes: 3 additions & 3 deletions tests/sentry/middleware/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class SetRemoteAddrFromForwardedForTestCase(TestCase):

def test_ipv4(self):
request = HttpRequest()
request.META["HTTP_X_FORWARDED_FOR"] = "8.8.8.8:80,8.8.4.4"
request.META["HTTP_X_FORWARDED_FOR"] = "8.8.8.8,8.8.4.4:80"
self.middleware.process_request(request)
assert request.META["REMOTE_ADDR"] == "8.8.8.8"
assert request.META["REMOTE_ADDR"] == "8.8.4.4"

def test_ipv4_whitespace(self):
request = HttpRequest()
Expand All @@ -32,7 +32,7 @@ def test_ipv6(self):
request = HttpRequest()
request.META["HTTP_X_FORWARDED_FOR"] = "2001:4860:4860::8888,2001:4860:4860::8844"
self.middleware.process_request(request)
assert request.META["REMOTE_ADDR"] == "2001:4860:4860::8888"
assert request.META["REMOTE_ADDR"] == "2001:4860:4860::8844"


test_region = Region(
Expand Down
Loading