mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
add test for test_check_valid_ip_sent_with_x_forwarded_for
This commit is contained in:
parent
b94c982ec9
commit
d0e6ca659f
2 changed files with 32 additions and 3 deletions
|
@ -1221,7 +1221,7 @@ def _check_valid_ip(
|
|||
|
||||
# if general_settings.get("use_x_forwarded_for") is True then use x-forwarded-for
|
||||
client_ip = None
|
||||
if use_x_forwarded_for is True:
|
||||
if use_x_forwarded_for is True and "x-forwarded-for" in request.headers:
|
||||
client_ip = request.headers["x-forwarded-for"]
|
||||
elif request.client is not None:
|
||||
client_ip = request.client.host
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue