retreive real client IP

This commit is contained in:
Emmanuel Viennet 2021-09-18 21:28:51 +02:00
parent 803fc1b298
commit 4cda88ccbd

View File

@ -34,7 +34,7 @@ def upload_dump():
now = datetime.datetime.now()
fulltime = now.isoformat()
# client addr:
remote_addr = request.environ.get("HTTP_X_FORWARDED_FOR", request.remote_addr)
remote_addr = request.environ.get("HTTP_X_REAL_IP", request.remote_addr)
log.write("{} request from {}\n".format(fulltime, remote_addr))
# Avec seulement alphanum et tiret:
clean_deptname = re.sub(r"[^A-Za-z-]", "", request.form["dept_name"])