forked from phoenix/litellm-mirror
feat log use_x_forwarded_for
This commit is contained in:
parent
ab208eb546
commit
0c6c350c23
1 changed files with 10 additions and 0 deletions
|
@ -177,7 +177,17 @@ async def add_litellm_data_to_request(
|
||||||
requester_ip_address = ""
|
requester_ip_address = ""
|
||||||
if premium_user is True:
|
if premium_user is True:
|
||||||
# Only set the IP Address for Enterprise Users
|
# Only set the IP Address for Enterprise Users
|
||||||
|
|
||||||
|
# logic for tracking IP Address
|
||||||
if (
|
if (
|
||||||
|
general_settings is not None
|
||||||
|
and general_settings.get("use_x_forwarded_for") is True
|
||||||
|
and request is not None
|
||||||
|
and hasattr(request, "headers")
|
||||||
|
and "x-forwarded-for" in request.headers
|
||||||
|
):
|
||||||
|
requester_ip_address = request.headers["x-forwarded-for"]
|
||||||
|
elif (
|
||||||
request is not None
|
request is not None
|
||||||
and hasattr(request, "client")
|
and hasattr(request, "client")
|
||||||
and hasattr(request.client, "host")
|
and hasattr(request.client, "host")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue