From d217b3e843284af039fac4ff2955ed923b5202cc Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 9 Feb 2023 10:11:34 +0200 Subject: [PATCH] fix ratelimiting in wpd --- files/__main__.py | 2 +- files/routes/wrappers.py | 4 ---- nginx.conf | 1 + 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/files/__main__.py b/files/__main__.py index 15e4c7efc..a773e79b0 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -61,7 +61,7 @@ def get_CF(): with app.app_context(): x = request.headers.get('CF-Connecting-IP') if x: return x - return request.remote_addr + return request.headers.get('X-Forwarded-For') limiter = Limiter( app=app, diff --git a/files/routes/wrappers.py b/files/routes/wrappers.py index eac0ab5de..1b04c8b55 100644 --- a/files/routes/wrappers.py +++ b/files/routes/wrappers.py @@ -18,10 +18,6 @@ def get_ID(): else: x = "logged_out" - if x == 9: - print(f'{SITE}-{x}', flush=True) - print(request.headers.get('CF-Connecting-IP'), flush=True) - print(request.remote_addr, flush=True) return f'{SITE}-{x}' diff --git a/nginx.conf b/nginx.conf index e3021f272..7f02eb4ac 100644 --- a/nginx.conf +++ b/nginx.conf @@ -5,6 +5,7 @@ server { listen [::]:80; proxy_set_header Host $http_host; include includes/headers; + proxy_set_header X-Forwarded-For $remote_addr; location / { proxy_pass http://localhost:5000/;