retreive real client IP

This commit is contained in:
Emmanuel Viennet 2021-09-18 21:30:21 +02:00
parent 4cda88ccbd
commit 3bc5de3afc

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_REAL_IP", 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"])