From a14c510afb36173fef89bdc0394689a6a2923979 Mon Sep 17 00:00:00 2001 From: Alberto Cano <34340962+canoalberto@users.noreply.github.com> Date: Sat, 20 Jul 2024 18:10:39 -0400 Subject: [PATCH] Customize the subpath for gradio, use with reverse proxy (#5106) --- modules/shared.py | 1 + server.py | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/shared.py b/modules/shared.py index 09cbedcf..20eaff58 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -195,6 +195,7 @@ group.add_argument('--gradio-auth', type=str, help='Set Gradio authentication pa group.add_argument('--gradio-auth-path', type=str, help='Set the Gradio authentication file path. The file should contain one or more user:password pairs in the same format as above.', default=None) group.add_argument('--ssl-keyfile', type=str, help='The path to the SSL certificate key file.', default=None) group.add_argument('--ssl-certfile', type=str, help='The path to the SSL certificate cert file.', default=None) +group.add_argument('--subpath', type=str, help='Customize the subpath for gradio, use with reverse proxy') # API group = parser.add_argument_group('API') diff --git a/server.py b/server.py index 7afa954e..f057d233 100644 --- a/server.py +++ b/server.py @@ -169,6 +169,7 @@ def create_interface(): ssl_verify=False if (shared.args.ssl_keyfile or shared.args.ssl_certfile) else True, ssl_keyfile=shared.args.ssl_keyfile, ssl_certfile=shared.args.ssl_certfile, + root_path=shared.args.subpath, allowed_paths=["cache", "css", "extensions", "js"] )