Hi guys, I am trying to expose a prefect server ui...
# ask-community
r
Hi guys, I am trying to expose a prefect server ui via nginx and I am struggling. I run prefect as a service with environment variables for PREFECT_API_URL, PREFECT_UI_URL, and PREFECT_UI_API_URL and I've gotten the ui to load with the setup below, however I am hosting another app using mydomain.com/api and then prefect on the client side cant communicate with the prefect api on the server (I assume because it's being redirected. Please could someone help me here. I love prefect but I am also a relatively new user.
Copy code
[Unit]
Description=Prefect Server
After=network.target

[Service]
Type=simple
User=root
Group=root
Environment="PREFECT_API_TLS_INSECURE_SKIP_VERIFY=true"
Environment="PREFECT_API_URL=<http://127.0.0.1:4200/api>"
Environment="PREFECT_UI_URL=<http://127.0.0.1:4200/>"
Environment="PREFECT_UI_API_URL=<https://mydomain.com/api>"
WorkingDirectory=/myapp
ExecStart=/myapp/.venv/bin/prefect server start --host 0.0.0.0
Restart=always
RestartSec=10
Environment="PATH=/myapp/.venv/bin:$PATH"

[Install]
WantedBy=multi-user.target
Copy code
location / {
        allow all;
        proxy_pass <http://127.0.0.1:4200/>;
        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;
        proxy_redirect off;
    }
}