Creating admin interface
This commit is contained in:
14
backend/app/core/utils.py
Normal file
14
backend/app/core/utils.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from fastapi import Request
|
||||
|
||||
|
||||
def get_client_ip(request: Request) -> str:
|
||||
"""Extract client IP address from request"""
|
||||
forwarded = request.headers.get("X-Forwarded-For")
|
||||
if forwarded:
|
||||
return forwarded.split(",")[0].strip()
|
||||
|
||||
real_ip = request.headers.get("X-Real-IP")
|
||||
if real_ip:
|
||||
return real_ip
|
||||
|
||||
return request.client.host if request.client else "127.0.0.1"
|
||||
Reference in New Issue
Block a user