feature: Add native prefix routing (root_path) support for BentoML ASGI apps including Swagger & all API endpoints
Feature request
I would like to request native prefix (root_path) support in BentoML’s ASGI stack so that all routes (Swagger UI, OpenAPI schema, and model APIs) can be reliably served under a custom base path such as:
/<prefix>/v1/...
This includes full integration with Swagger UI, model API paths, and OpenAPI server URLs.
Motivation
First of all, thank you to the BentoML team for building such a powerful and developer-friendly system. I am currently testing BentoML in an environment where a prefix is mandatory due to organizational routing and gateway policies.
Even when following the official “Customize the prefix path” documentation, I found that the prefix does not propagate correctly to: • Swagger UI • model API endpoints
This makes it difficult to deploy BentoML behind ingress controllers or gateway-managed sub-paths.
Native prefix support would significantly simplify deployment and improve compatibility with enterprise infrastructure.
Other
No response
It's good to have, and have little impact
A question, should system routes(/metrics, /livez, /readyz) also be served under root path?
@ryankim8815 is this assigned to someone ?, can you assign this to me, I would love to work on this Asap !!
@frostming In my environment, system routes also need to respect and operate under the configured root path in order to be accessible. Thank you very much for taking the time to look into my issue. @immortal71 Thank you for your interest in helping. I appreciate it, but I don’t have permission to assign this issue.
@immortal71 just start working and make the PR. Assignment shouldn't block you.