Bentoml: Support URL location prefix in yatai-service gRPC/Web server

Created on 3 Sep 2020  路  3Comments  路  Source: bentoml/BentoML

Is your feature request related to a problem? Please describe.

It is common to run YataiService behind a reverse proxy server, and the user may want to add a location prefix to the URL being proxied. Currently, the YataiService Web UI does not work properly when a location prefix is specified, and we should support it.

Describe the solution you'd like

Add a parameter to YataiService entry point to set a custom URL prefix, e.g.:

bentoml yatai-service-start --base-url="/yatai"
# or
docker run -p 50051:50051 -p 3000:3000 bentoml/yatai-service:latest --base-url="/yatai"

Describe alternatives you've considered

n/a

Additional context

Related discussion #1057 https://github.com/bentoml/BentoML/discussions/1057

MLH new feature

Most helpful comment

@kishore-ganesh you are right, I think it was a typo. For Yatai service webui, it should routes to 127.0.0.1:3000

All 3 comments

Besides yatai-service, would this also address the User-Defined API.

I notice the following behavior behind a reverse proxy:

http://<friendly-url>/<some_prefix>/<api_name>- correctly gets routed to the Gunicorn / Flask API endpoint

but

http://<friendly-url>/<some_prefix>/

does NOT serve the swagger

My thinking is that both issues with yatai-webui and swagger-ui - have the same type of cause / fix.
Let me know if your thinking is also the same.

With regards to #1057, I wanted to confirm whether I understood the issue correctly. I had tried reproducing it by setting up a reverse proxy, and the issue was that the requests were being routed to reverseproxyurl/requesturl instead of reverseproxyurl/prefix/requesturl. Is this the issue? I wasn't able to understand the given example (how are requests to https://friendly-url.com/yatai routed to 127.0.0.1/:3000/webui ? Shouldn't they be routed to 127.0.0.1/:3000 as configured?

@kishore-ganesh you are right, I think it was a typo. For Yatai service webui, it should routes to 127.0.0.1:3000

Was this page helpful?
0 / 5 - 0 ratings