BentoML icon indicating copy to clipboard operation
BentoML copied to clipboard

feature: Add native prefix routing (root_path) support for BentoML ASGI apps including Swagger & all API endpoints

Open ryankim8815 opened this issue 1 month ago • 5 comments

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

ryankim8815 avatar Nov 24 '25 09:11 ryankim8815

It's good to have, and have little impact

frostming avatar Nov 25 '25 00:11 frostming

A question, should system routes(/metrics, /livez, /readyz) also be served under root path?

frostming avatar Nov 25 '25 03:11 frostming

@ryankim8815 is this assigned to someone ?, can you assign this to me, I would love to work on this Asap !!

immortal71 avatar Nov 25 '25 04:11 immortal71

@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.

ryankim8815 avatar Nov 26 '25 01:11 ryankim8815

@immortal71 just start working and make the PR. Assignment shouldn't block you.

frostming avatar Nov 26 '25 09:11 frostming