Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set URL prefix for server API #12096

Open
4 tasks done
majikman111 opened this issue Feb 27, 2024 · 1 comment
Open
4 tasks done

Unable to set URL prefix for server API #12096

majikman111 opened this issue Feb 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@majikman111
Copy link

First check

  • I added a descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Prefect documentation for this issue.
  • I checked that this issue is related to Prefect and not one of its dependencies.

Bug summary

I am running Prefect in a Kubernetes cluster behind an nginx reverse proxy and when setting the PREFECT_UI_SERVE_BASE setting the UI base path is updated but api base path is not, resulting in a rendered UI with no flow content. Additionally, updating the PREFECT_UI_API_URL setting changes what path the UI requests but not the path the api is actually served under.

Reproduction

1. Install Prefect
1. Apply settings `PREFECT_UI_SERVE_BASE=/root/` and `PREFECT_UI_API_URL=localhost:4200/root/api`
1. Run `prefect server start`
1. Browse to local prefect server at `localhost:4200/root`

The UI renders and api requests are sent to `localhost:4200/root/api` but fail (are being served from `localhost:4200/api`)

Error

No response

Versions

Version:               2.16.0
API version:           0.8.4
Python version:        3.11.8
Git commit:            17f42e9d
Built:                 Thu, Feb 22, 2024 3:45 PM
OS/Arch:               linux/x86_64
Profile:               default
Server type:           server

Additional context

Could potentially be solved by passing a configurable root_path argument to the FastAPI api_app object if available from settings here
https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/server.py#L615

Related to #11472

@majikman111 majikman111 added bug Something isn't working needs:triage Needs feedback from the Prefect product team labels Feb 27, 2024
@mthanded
Copy link
Contributor

Came across this recently. I'm currently rewriting prefix/api to /api using traefik rules. I agree it would be useful to have support for configuring the api to run at a path prefix too.

@zhen0 zhen0 removed the needs:triage Needs feedback from the Prefect product team label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants