Skip to content
This repository has been archived by the owner on Jun 15, 2019. It is now read-only.

Commit

Permalink
Use custom header to get IP address (when it exists)
Browse files Browse the repository at this point in the history
  • Loading branch information
codeinthehole committed Jul 24, 2013
1 parent f3913ff commit 1018f85
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions datacash/the3rdman/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def build_customer_info(request, user, email, order_number, shipping_address):

if request and 'REMOTE_ADDR' in request.META:
payload['ip_address'] = request.META['REMOTE_ADDR']
# We let HTTP_X_FORWARDED_FOR take precedence if it exists
if request and 'HTTP_X_FORWARDED_FOR' in request.META:
payload['ip_address'] = request.META['HTTP_X_FORWARDED_FOR']

if order_number:
payload['order_number'] = order_number
Expand Down

0 comments on commit 1018f85

Please sign in to comment.