Utkarsh Jain
08/15/2025, 7:21 AMMarvin
08/15/2025, 7:21 AMMarvin
08/15/2025, 7:24 AMPREFECT_UI_URL=<https://prefect.example.com>
- PREFECT_UI_API_URL=<https://prefect.example.com/api>
- Don’t rewrite away /api. The UI calls /api/... from the browser; if your proxy strips or rewrites that path, you’ll get 401/404 and other cheerful surprises.
- Ensure auth middleware applies to both / (UI) and /api (API). If only / is protected, the browser’s API calls to /api will be blocked by the proxy or fail CORS.
- If you split UI and API across different hosts, you’ll need proper CORS headers; easiest is to keep them on the same hostname.
Common Traefik pitfalls that look like “authorization errors”
- Path rewriting of /api or mismatched PREFECT_UI_API_URL
- Protecting only the UI route, not /api
- Double-auth (Traefik OIDC + Prefect basic auth) causing 401s
- Missing header/cookie forwarding in ForwardAuth middleware
If you want RBAC without more yak-shaving, Prefect Cloud does it out of the box with OIDC (Keycloak works as a generic OIDC provider): Cloud SSO docs.
If you share:
- Whether you’re on Cloud or self-hosted (and Prefect version),
- Your Traefik router/middleware snippet,
- The exact endpoint returning 401/403 (e.g., /api/health, /api/flows, or just the UI),
I can point at the precise misconfiguration instead of waving generally at your proxy.