diff --git a/sanic/server.py b/sanic/server.py index 70dca448..0fd85440 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -114,6 +114,10 @@ class HttpProtocol(asyncio.Protocol): self.headers.append((name.decode(), value.decode('utf-8'))) def on_headers_complete(self): + remote_addr = self.transport.get_extra_info('peername') + if remote_addr: + self.headers.append(('Remote-Addr', '%s:%s' % remote_addr)) + self.request = Request( url_bytes=self.url, headers=dict(self.headers),