From 5118fd6989df3775d1ae4e555b7746cb512ee51a Mon Sep 17 00:00:00 2001 From: "juancarlos.cavero" Date: Thu, 16 Jul 2026 18:49:35 +0200 Subject: [PATCH] fix(prod): trust proxy headers so OAuth redirect_uri uses https Behind Coolify's reverse proxy the backend saw requests as http and built an http:// redirect_uri, causing Google 'redirect_uri_mismatch'. Run uvicorn with --proxy-headers --forwarded-allow-ips=* so X-Forwarded-Proto (https) is honored. --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3e336d9..0bcdb03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -76,5 +76,7 @@ RUN python -c "from ultralytics import YOLO; YOLO('yolov8n.pt')" # Expose FastAPI port EXPOSE 8000 -# Run FastAPI app -CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] +# Run FastAPI app. --proxy-headers + --forwarded-allow-ips trust the reverse +# proxy's X-Forwarded-Proto so generated URLs (e.g. the OAuth redirect_uri) use +# https in production instead of the internal http scheme. +CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers", "--forwarded-allow-ips", "*"]