skaaks
06/13/2024, 2:03 PMMarvin
06/13/2024, 2:03 PMPREFECT_UI_SERVE_BASE
for the UI. The default base path for the API is <http://127.0.0.1:4200/api>
.
However, you can work around this by using a reverse proxy (such as Nginx or Traefik) to achieve the desired routing. With the right configuration, the proxy server can forward requests from your custom path to the default Prefect API path.
Here's a general approach using Nginx:
1. Install Nginx:
bash
sudo apt update
sudo apt install nginx
2. Configure Nginx for your custom path:
Edit your Nginx configuration file to include the following:
nginx
server {
listen 80;
server_name your_domain_or_ip;
location /custom_path/api {
proxy_pass <http://127.0.0.1:4200/api;>
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Replace /custom_path/api
with your preferred path and your_domain_or_ip
with your server's domain or IP address.
3. Restart Nginx:
bash
sudo systemctl restart nginx
With this setup, requests to {host}/custom_path/api
will be forwarded to the Prefect API running at {host}/api
.
---
References:
- Prefect Hosting Guide
- Prefect Settings Guidance
For more detailed configurations, please refer to the Nginx documentation.