Skip to content

Commit

Permalink
Use X-Forwarded-For
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-z committed Oct 30, 2023
1 parent 39b332e commit fda7a92
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fda7a92

Please sign in to comment.