Vishnu Sajan
11/21/2025, 6:51 PMMarvin
11/21/2025, 6:51 PMMarvin
11/21/2025, 6:54 PMPREFECT_UI_API_URL is not set, the UI builds its API URL from PREFECT_SERVER_API_HOST and PREFECT_SERVER_API_PORT.
- With PREFECT_SERVER_API_HOST=0.0.0.0, the UI ends up trying to hit <http://0.0.0.0:4200/api> from your browser, which fails.
Fix
- Set PREFECT_UI_API_URL to an address your browser can reach:
- If you’re running Docker locally and visiting from the same machine: <http://localhost:4200/api>
- If you’re on a remote VM: http://<your-hostname-or-ip>:4200/api
Update your docker-compose for the server container like this:
services:
prefect-server:
image: prefecthq/prefect:3-latest
environment:
PREFECT_API_DATABASE_CONNECTION_URL: <postgresql+asyncpg://prefect:prefect@postgres:5432/prefect>
PREFECT_SERVER_API_HOST: 0.0.0.0
PREFECT_UI_API_URL: <http://localhost:4200/api> # or http://<host>:4200/api if remote
PREFECT_MESSAGING_BROKER: prefect_redis.messaging
PREFECT_MESSAGING_CACHE: prefect_redis.messaging
PREFECT_REDIS_MESSAGING_HOST: redis
PREFECT_REDIS_MESSAGING_PORT: 6379
PREFECT_REDIS_MESSAGING_DB: 0
command: prefect server start --no-services
ports:
- "4200:4200"
Notes
- Workers inside the compose network should still use the internal URL, e.g. PREFECT_API_URL=<http://prefect-server:4200/api>.
- Make sure port mapping 4200:4200 is present and you’re visiting http://localhost:4200 (or the remote host).
Helpful references
- Self-hosted with Docker Compose (source for the official example): Docs: Docker Compose
- UI setting that determines this behavior: prefect.settings.server.ui
If this doesn’t fix it, can you share:
- Whether you’re running locally or on a remote VM
- The prefect-server section of your compose file
- Any logs from the prefect-server container right after startup
I’ll help you get it sorted quickly.Vishnu Sajan
11/22/2025, 12:58 PMMarvin
11/22/2025, 12:58 PMMarvin
11/22/2025, 12:58 PMPREFECT_UI_API_URL is not explicitly set.
- The log lines showing 0.0.0.0 are expected (that’s the bind address inside the container), but the UI needs a browser-reachable URL.
Fix
- Add PREFECT_UI_API_URL to the prefect-server service so the UI knows to call localhost:
prefect-server:
image: prefecthq/prefect:3-latest
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
PREFECT_API_DATABASE_CONNECTION_URL: <postgresql+asyncpg://prefect:prefect@postgres:5432/prefect>
PREFECT_SERVER_API_HOST: 0.0.0.0
PREFECT_UI_API_URL: <http://localhost:4200/api>
PREFECT_MESSAGING_BROKER: prefect_redis.messaging
PREFECT_MESSAGING_CACHE: prefect_redis.messaging
PREFECT_REDIS_MESSAGING_HOST: redis
PREFECT_REDIS_MESSAGING_PORT: 6379
PREFECT_REDIS_MESSAGING_DB: 0
command: prefect server start --no-services
ports:
- "4200:4200"
Then recreate the container:
docker compose up -d --force-recreate
And hard-refresh the UI (Shift+Reload or Ctrl/Cmd+Shift+R).
Quick checks
- Open http://localhost:4200/docs — if that loads, the API is up.
- In DevTools > Network, the UI calls should now hit http://localhost:4200/api/... (not 0.0.0.0).
References
- Official Docker Compose guide: Docs: Docker Compose
- UI setting used to determine the API URL: prefect.settings.server.ui
If you still see the error after this, please share:
- A fresh log snippet from the prefect-server container after restart
- Screenshot or text of the failing UI Network request URL in DevTools
- Confirmation that you’re visiting http://localhost:4200 (no proxies in between)