Commits

Anonymous committed 7f7e38d

added code to handle akamai's site accelerator's masking of original IP

  • Participants
  • Parent commits 3bf9215

Comments (0)

Files changed (1)

visitor/visitor_utils.py

     meta = request.META
 
   # figure out the IP
-    if 'REMOTE_ADDR' in meta and meta.get('REMOTE_ADDR', '') != '127.0.0.1':
+    if 'HTTP_TRUE_CLIENT_IP' in meta:
+        # Akamai's Site accelorator's proxy header for real IP
+        ip_address = meta.get('HTTP_TRUE_CLIENT_IP', '')
+    elif 'REMOTE_ADDR' in meta and meta.get('REMOTE_ADDR', '') != '127.0.0.1':
         ip_address = meta.get('REMOTE_ADDR', '')
     elif 'HTTP_X_REAL_IP' in meta:
         ip_address = meta.get('HTTP_X_REAL_IP', '')