# check IP address
if not offline:
if myip is None:
- raise MyipMissing()
+ # try HTTP_X_FORWARDED_FOR
+ myip = os.environ.get('HTTP_X_FORWARDED_FOR')
+ if not myip: # empty string if not present
+ # try REMOTE_ADDR
+ myip = os.environ.get('REMOTE_ADDR')
+ if not myip: # empty string if not present
+ raise MyipMissing()
try:
ip = ipaddr.IPAddress(myip) # throws an exception if the IP address is not valid
except ValueError: