[feature] Custom base path on FastAPI server (#5879)
Co-authored-by: lianhu.yin <lianhu.yin@nio.com> Co-authored-by: kebyn <kebyn@kebyn.cc> Co-authored-by: Liangsheng Yin <lsyincs@gmail.com>
This commit is contained in:
co-authored by
lianhu.yin
kebyn
Liangsheng Yin
parent
9ba3597d2a
commit
15db5497d3
@@ -1383,6 +1383,7 @@ def launch_server(
|
|||||||
app,
|
app,
|
||||||
host=server_args.host,
|
host=server_args.host,
|
||||||
port=server_args.port,
|
port=server_args.port,
|
||||||
|
root_path=server_args.fastapi_root_path,
|
||||||
log_level=server_args.log_level_http or server_args.log_level,
|
log_level=server_args.log_level_http or server_args.log_level,
|
||||||
timeout_keep_alive=5,
|
timeout_keep_alive=5,
|
||||||
loop="uvloop",
|
loop="uvloop",
|
||||||
@@ -1401,6 +1402,7 @@ def launch_server(
|
|||||||
"sglang.srt.entrypoints.http_server:app",
|
"sglang.srt.entrypoints.http_server:app",
|
||||||
host=server_args.host,
|
host=server_args.host,
|
||||||
port=server_args.port,
|
port=server_args.port,
|
||||||
|
root_path=server_args.fastapi_root_path,
|
||||||
log_level=server_args.log_level_http or server_args.log_level,
|
log_level=server_args.log_level_http or server_args.log_level,
|
||||||
timeout_keep_alive=5,
|
timeout_keep_alive=5,
|
||||||
loop="uvloop",
|
loop="uvloop",
|
||||||
|
|||||||
@@ -243,6 +243,7 @@ class ServerArgs:
|
|||||||
# HTTP server
|
# HTTP server
|
||||||
host: str = "127.0.0.1"
|
host: str = "127.0.0.1"
|
||||||
port: int = 30000
|
port: int = 30000
|
||||||
|
fastapi_root_path: str = ""
|
||||||
grpc_mode: bool = False
|
grpc_mode: bool = False
|
||||||
skip_server_warmup: bool = False
|
skip_server_warmup: bool = False
|
||||||
warmups: Optional[str] = None
|
warmups: Optional[str] = None
|
||||||
@@ -2024,6 +2025,12 @@ class ServerArgs:
|
|||||||
default=ServerArgs.port,
|
default=ServerArgs.port,
|
||||||
help="The port of the HTTP server.",
|
help="The port of the HTTP server.",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--fastapi-root-path",
|
||||||
|
type=str,
|
||||||
|
default=ServerArgs.fastapi_root_path,
|
||||||
|
help="App is behind a path based routing proxy.",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--grpc-mode",
|
"--grpc-mode",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
|
|||||||
Reference in New Issue
Block a user