mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-25 17:31:00 +00:00
Better X-Forwarded-For logic
This commit is contained in:
parent
eb8b389e5e
commit
94f4f74892
1 changed files with 1 additions and 1 deletions
|
@ -20,7 +20,7 @@ def get_json_dict(request):
|
||||||
|
|
||||||
def get_remote_address():
|
def get_remote_address():
|
||||||
if request.headers.getlist("X-Forwarded-For"):
|
if request.headers.getlist("X-Forwarded-For"):
|
||||||
ip = request.headers.getlist("X-Forwarded-For")[0]
|
ip = request.headers.getlist("X-Forwarded-For")[0].split(",")[0]
|
||||||
else:
|
else:
|
||||||
ip = request.remote_addr or "127.0.0.1"
|
ip = request.remote_addr or "127.0.0.1"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue