Skip to content

Commit

Permalink
feat: log start of gunicorn request
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-richards committed Nov 4, 2024
1 parent 211fed3 commit 79fcaca
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions dev/build/gunicorn.conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,14 @@
}
}
}

def pre_request(worker, req):
client_ip = "-"
cf_ray = "-"
for (header, value) in req.headers:
header = header.lower()
if header == "cf-connecting-ip":
client_ip = value
elif header == "cf-ray":
cf_ray = value
worker.log.info(f"gunicorn starting to process {req.method} {req.path} (client_ip={client_ip}, cf_ray={cf_ray})")

0 comments on commit 79fcaca

Please sign in to comment.