https://prefect.io logo
#prefect-community
Title
# prefect-community
m

Michael Dyer

09/09/2022, 8:02 PM
I am running prefect 2.3 inside a docker container using the following command:
prefect orion start --host 0.0.0.0
I have a reverse proxy (traefik) pointing to the container and I can access the UI at
<https://my-host:4200>
. The reverse proxy is handling ssl offload. The UI is displayed, but unable to connect to the API and I'm receiving the following message:
Copy code
Can't connect to Orion API at <http://127.0.0.1:4200/api>. Check that it's accessible from your machine.
Q. Is there a way to configure the Orion UI so that it uses a relative URL
/api
? (i.e. https://my-host:4200/api)?
c

Christopher Boyd

09/09/2022, 8:30 PM
Hi Michael, is there a reason for doing it this way over using kubernetes for doing something similar ? Are you just running this locally ? I believe is is a docker / kubernetes networking function (regarding the endpoint URI) and not something prefect configured
c

Cole Murray

09/09/2022, 8:38 PM
You can override the URL with this flag: https://docs.prefect.io/concepts/settings/#prefect_api_url I’m not 100% sure it overrides the UI’s api url, but it definitely overrides it for agents
c

Christopher Boyd

09/09/2022, 8:40 PM
Correct , that setting overrides the client side connection end point, not the server side configuration - it seems like you want to update the server side being hosted through nginx reverse proxy which is a base url / Reverse proxy mapping feature
I'd need a few to find the setting, but updating the API url is local, it's not updating the hosted endpoint
m

Michael Dyer

09/09/2022, 8:45 PM
this is a docker-compose environment. k8s is a massive overkill for what we're doing.
r

Ryan Peden

09/09/2022, 8:45 PM
I believe
PREFECT_ORION_UI_API_URL
is the environment variable you will need to set to ensure the UI calls the correct API URL.
m

Michael Dyer

09/09/2022, 8:54 PM
Thanks - setting
PREFECT_ORION_UI_API_URL
allows me to access the api. The significant downside is that I need to modify the configuration for each deployment. A relative URL would avoid the extra per-deployment configuration by simply re-using the protocol://host:port from which the UI is being served.
just sayin' 🙂
something like:
Copy code
export const getAPIAddress = () => `${window.location.protocol}//${window.location.hostname}:4200/api`;