<@ULVA73B9P> if i am using prefect in one computer and want to acess the server api in another compu...
v
@Marvin if i am using prefect in one computer and want to acess the server api in another computer that has starts in the origin computer, how can i do it?
m
thought for 142.0 seconds
Great question! Assuming you’re on Prefect 3.x, here’s how to expose your locally running Prefect Server so another computer can access it. 1) Start the server bound to all interfaces on the origin machine By default,
prefect server start
binds to 127.0.0.1 (localhost only). Bind to 0.0.0.0 so it’s reachable from your network:
Copy code
prefect server start --host 0.0.0.0 --port 4200
- UI will be at: http//&lt;origin ip&gt;4200/ - API will be at: http//&lt;origin ip&gt;4200/api 2) Configure the client on the other machine to point at the API Set
PREFECT_API_URL
on the machine that needs to connect: - Persist it in your Prefect profile:
Copy code
prefect config set PREFECT_API_URL="http://<origin-ip>:4200/api"
- Or set it just for the current shell session: - macOS/Linux:
Copy code
export PREFECT_API_URL="http://<origin-ip>:4200/api"
- Windows (PowerShell):
Copy code
$env:PREFECT_API_URL="http://<origin-ip>:4200/api"
3) Network considerations - Open/allow inbound TCP 4200 on the origin machine’s firewall/security group - Ensure both machines can reach each other over the network (same LAN/VPC, correct routing) - If you plan to expose this beyond your LAN, put a reverse proxy (e.g., NGINX) in front with HTTPS and point clients to
<https://your-domain/api>
Handy settings (optional) -
PREFECT_SERVER_API_HOST
and
PREFECT_SERVER_API_PORT
control the server’s bind host/port -
PREFECT_API_URL
is what clients (CLI, workers, flows) use to talk to the API - The API base path is
/api
— don’t forget that suffix in the URL Would you like help setting up a reverse proxy/TLS, or verifying connectivity from the client machine?