From 81fba8c4d0e298ed51fb54da108cb5e4a346bfdb Mon Sep 17 00:00:00 2001 From: sherl Date: Sun, 5 Oct 2025 23:42:23 +0200 Subject: [PATCH] fix: handle forwarded requests proxied requests are now counted correctly --- ythdd_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ythdd_api.py b/ythdd_api.py index 0672e68..d78bd68 100644 --- a/ythdd_api.py +++ b/ythdd_api.py @@ -14,8 +14,8 @@ def api_greeting(): def api_global_catchall(received_request): ythdd_globals.apiRequests += 1 - if request.environ['REMOTE_ADDR'] != "127.0.0.1" or (ythdd_globals.isProxied and request.environ['X-Forwarded-For'] != "127.0.0.1"): - ythdd_globals.outsideApiHits += 1 + if request.environ['REMOTE_ADDR'] != "127.0.0.1" or (ythdd_globals.isProxied and request.environ['HTTP_X_FORWARDED_FOR'] != "127.0.0.1"): + ythdd_globals.outsideApiHits += 1 request_list = received_request.split('/') api_version = request_list[0]