From fda7a92fe2833ff730cdbf068508356e997ca1fa Mon Sep 17 00:00:00 2001 From: Ben Zhang Date: Mon, 30 Oct 2023 10:11:13 +0000 Subject: [PATCH] Use X-Forwarded-For --- app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 9d588e6..27f7ff5 100644 --- a/app.py +++ b/app.py @@ -40,7 +40,10 @@ def tunnel(): logging.debug(f"Forwarding envelope to {dsn.hostname} for project {project_id}") url = f"https://{dsn.hostname}/api/{project_id}/envelope/" - requests.post(url=url, data=envelope, headers={"Content-Type": "application/x-sentry-envelope"}) + requests.post(url=url, data=envelope, headers={ + "Content-Type": "application/x-sentry-envelope", + "X-Forwarded-For": request.remote_addr, + }) except Exception as e: # handle exception in your preferred style, # e.g. by logging or forwarding to Sentry