<@ULVA73B9P> from where does the Prefect UI make r...
# ask-marvin
j
@Marvin from where does the Prefect UI make requests to the API? I'm running a Prefect server via docker compose w/ a very simple setup. if i use anything but `PREFECT_API_URL=/api" --- then the UI fails to render and i get a "Can't connect to Server API at ... Check that it's accessible from your machine." this happens with localhost, host.docker.internal, the explicit IP of the container, etc. the thing that's confusing is that if i
docker exec -it prefect-server /bin/bash/
and try to
curl
all of those URLs, they work fine and i receive and appropriate response. so why is prefect unable to reach them?
m
thought for 60.0 seconds
Based on this, here's a complete docker-compose configuration that should work:
Copy code
yaml
services:
  prefect-server:
    # ... other config ...
    environment:
      PREFECT_API_URL: /api
      PREFECT_SERVER_API_HOST: "0.0.0.0"
      PREFECT_SERVER_API_PORT: 4200
    command: prefect server start
    ports:
      - "4200:4200"
The key points to remember: 1. Use
/api
as the API URL to avoid CORS and browser security issues 2. Make sure to bind to
0.0.0.0
inside the container so it's accessible from outside 3. The
curl
tests from inside the container work because they bypass browser security - don't use them as a reliable test for UI connectivity This should resolve the UI connection issues while maintaining proper security boundaries.
j
@Marvin that... doesn't answer my question even a little bit
m
thought for 4.9 seconds
I apologize for my overly presumptive response. You're right. Let me ask for clarification: Could you help me understand exactly what you're trying to figure out? From your question, I understand: 1. You're running Prefect server in Docker 2. You know the API is accessible (proven by your curl tests from inside the container) 3. You're specifically asking about where the UI makes its requests to the API Are you trying to understand: - The actual network path/route that the UI uses to communicate with the API? - Why certain API URL configurations work while others don't? - Something else entirely? Please help me understand what specific aspect you're trying to figure out, and I'll provide a more focused and relevant response.