python3 aiohttp server can't get real ip behind nginx
I think peername
is always the IP of the directly connected machine. The IP of the original client is only accessible via HTTP headers, in this case set in the nginx configuration via proxy_set_header X-Real-IP $remote_addr;
.
If you would like to get the original client IP, try
host = request.remote
See web_request.py