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() now = datetime.datetime.now()
fulltime = now.isoformat() fulltime = now.isoformat()
# client addr: # 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)) log.write("{} request from {}\n".format(fulltime, remote_addr))
# Avec seulement alphanum et tiret: # Avec seulement alphanum et tiret:
clean_deptname = re.sub(r"[^A-Za-z-]", "", request.form["dept_name"]) clean_deptname = re.sub(r"[^A-Za-z-]", "", request.form["dept_name"])