Log one line per request with the visitor's address

Uvicorn's access log named only the proxy (172.17.0.1), with no time
taken or client. Each request is now one line: the visitor's address
from route-proxy's X-Forwarded-For, the request, status, size, duration,
referrer and user agent; uvicorn's own access log is off.

Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
This commit is contained in:
2026-11-27 09:46:56 +01:00
parent 1e2c1b898f
commit 3271e2d563
2 changed files with 35 additions and 2 deletions
+2 -2
View File
@@ -22,10 +22,10 @@ RUN apk add --no-cache \
COPY service/requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY cdn-api.py circuits_service.py ergast_service.py posters_service.py ./
COPY cdn-api.py access_log.py circuits_service.py ergast_service.py posters_service.py ./
COPY models/ ./models/
COPY circuits/ ./circuits/
EXPOSE 8000
CMD ["uvicorn", "cdn-api:app", "--host", "0.0.0.0", "--port", "8000"]
CMD ["uvicorn", "cdn-api:app", "--host", "0.0.0.0", "--port", "8000", "--no-access-log"]