How do I safely get the user's real IP address in Flask (using mod_wsgi)?
问题 I have a flask app setup on mod_wsgi/Apache and need to log the IP Address of the user. request.remote_addr returns "127.0.0.1" and this fix attempts to correct that but I've found that Django removed similar code for security reasons. Is there a better way to safely get the user's real IP address? EDIT: Maybe I'm missing something obvious. I applied werkzeug's/Flask's fix but it doesn't seem to make a difference when I try a request with altered headers: run.py: from werkzeug.contrib.fixers