fix: handle forwarded requests
proxied requests are now counted correctly
This commit is contained in:
@@ -14,7 +14,7 @@ def api_greeting():
|
|||||||
|
|
||||||
def api_global_catchall(received_request):
|
def api_global_catchall(received_request):
|
||||||
ythdd_globals.apiRequests += 1
|
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"):
|
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
|
ythdd_globals.outsideApiHits += 1
|
||||||
|
|
||||||
request_list = received_request.split('/')
|
request_list = received_request.split('/')
|
||||||
|
|||||||
Reference in New Issue
Block a user