diff --git a/sanic/request.py b/sanic/request.py index ab70e49b..bc1be96b 100644 --- a/sanic/request.py +++ b/sanic/request.py @@ -169,14 +169,8 @@ class Request(dict): @property def ip(self): if not hasattr(self, '_ip'): - self._ip = None - for key in HEADER_PRECEDENCE_ORDER: - value = self.headers.get(key, self.headers.get(key.replace('_', '-'), '')).strip() - if value is not None and value != '': - for ip_str in [ip.strip().lower() for ip in value.split(',')]: - if ip_str and is_valid_ip(ip_str): - if not ip_str.startswith(NON_PUBLIC_IP_PREFIX): - self._ip = ip_str + self._ip = (self.transport.get_extra_info('peername') or + (None, None)) return self._ip @property