fix: trust docker gateway IP for reverse proxy auth
Deploy Dashboard / deploy (push) Successful in 1m35s

This commit is contained in:
Gan, Jimmy
2026-02-27 23:48:34 +08:00
parent 3888a57642
commit a0354c335b
4 changed files with 26 additions and 4 deletions
+2 -1
View File
@@ -119,7 +119,8 @@ async def health():
@app.get("/api/client-ip")
async def client_ip(request: Request):
ip = request.client.host
if ip in ("127.0.0.1", "::1"):
import config
if config.is_trusted_proxy(ip):
forwarded = request.headers.get("x-forwarded-for", "").split(",")[0].strip()
if forwarded:
ip = forwarded