fix: handle forwarded requests
proxied requests are now counted correctly
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user