middleware: Stop using X_REAL_IP.

The comment was wrong, in that REMOTE_ADDR is where the real external
IP was; X_REAL_IP was the loadbalancer's IP.
This commit is contained in:
Tim Abbott 2020-05-08 11:38:58 -07:00
parent e2e0039ffe
commit a702894e0e
2 changed files with 2 additions and 7 deletions

View File

@ -276,10 +276,7 @@ class LogRequests(MiddlewareMixin):
# intends to block, so we stop here to avoid unnecessary work.
return response
# The reverse proxy might have sent us the real external IP
remote_ip = request.META.get('HTTP_X_REAL_IP')
if remote_ip is None:
remote_ip = request.META['REMOTE_ADDR']
remote_ip = request.META['REMOTE_ADDR']
# Get the requestor's identifier and client, if available.
try:

View File

@ -113,9 +113,7 @@ def report_error(request: HttpRequest, user_profile: UserProfile, message: str=R
version = None
# Get the IP address of the request
remote_ip = request.META.get('HTTP_X_REAL_IP')
if remote_ip is None:
remote_ip = request.META['REMOTE_ADDR']
remote_ip = request.META['REMOTE_ADDR']
# For the privacy of our users, we remove any actual text content
# in draft_content (from drafts rendering exceptions). See the