diff --git a/sanic/request.py b/sanic/request.py index eb05f471..27ff011e 100644 --- a/sanic/request.py +++ b/sanic/request.py @@ -168,7 +168,9 @@ class Request(dict): if not hasattr(self, '_remote_addr'): forwarded_for = self.headers.get('X-Forwarded-For', '').split(',') remote_addrs = [ - addr for addr in [addr.strip() for addr in forwarded_for] if addr + addr for addr in [ + addr.strip() for addr in forwarded_for + ] if addr ] if len(remote_addrs) > 0: self._remote_addr = remote_addrs[0]