I have a Python/FastAPI Omebox application where users can share text and files. The application generates URLs for previews and sharing.
When I deploy the application on Render, generated URLs use HTTPS correctly.
However, when I deploy the same Docker image on a VPS using Coolify, the application generates HTTP URLs instead, even though the site is accessible through HTTPS in the browser.
| Environment | Generated Share URL |
|---|---|
| VPS Server (Coolify) | http://omebox.com/s/GjMNH0fzDXagooc3 |
| Render Server | https://omebox.com/s/GjMNH0fzDXagooc3 |
The website itself is accessible via HTTPS in both cases, but when the application generates share links, the VPS deployment produces HTTP URLs while the Render deployment produces HTTPS URLs.
The application is built with FastAPI and runs in Docker using Uvicorn.
Dockerfile:
FROM python:3.11-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
libmagic1 \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN mkdir -p uploads cache
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
My assumption is that FastAPI/Uvicorn is not detecting the original HTTPS request when running behind the Coolify reverse proxy.
Could this be related to X-Forwarded-Proto or trusted proxy settings? What should I check in Coolify, Nginx/Traefik, or FastAPI to ensure generated URLs use HTTPS?