From c92d7e5ce3395875f007bbc0233fadb9fee8cbf0 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Thu, 31 Oct 2024 06:59:39 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Change:=20localhost=E3=81=AE=E7=AF=84?= =?UTF-8?q?=E5=9B=B2=E3=82=92=E6=8B=A1=E5=A4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- voicevox_engine/app/middlewares.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voicevox_engine/app/middlewares.py b/voicevox_engine/app/middlewares.py index 3c44a2125..5825b2aa8 100644 --- a/voicevox_engine/app/middlewares.py +++ b/voicevox_engine/app/middlewares.py @@ -28,7 +28,7 @@ async def global_execution_handler(request: Request, exc: Exception) -> Response app.add_middleware(ServerErrorMiddleware, handler=global_execution_handler) # CORS用のヘッダを生成するミドルウェア - localhost_regex = "^https?://(localhost|127\\.0\\.0\\.1|\\[::1\\])(:[0-9]+)?$" + localhost_regex = r"^[a-zA-Z+\-\.]+://(([^/]+\.)localhost|127\.0\.0\.1|\[::1\])(:[0-9]+)?$" compiled_localhost_regex = re.compile(localhost_regex) allowed_origins = ["*"] if cors_policy_mode == "localapps": From a31fba8a3c7a9430a697e18e39f3f9117f258415 Mon Sep 17 00:00:00 2001 From: "Nanashi." Date: Thu, 31 Oct 2024 16:05:24 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Code:=20=E3=83=95=E3=82=A9=E3=83=BC?= =?UTF-8?q?=E3=83=9E=E3=83=83=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- voicevox_engine/app/middlewares.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/voicevox_engine/app/middlewares.py b/voicevox_engine/app/middlewares.py index 5825b2aa8..14fd9e1f2 100644 --- a/voicevox_engine/app/middlewares.py +++ b/voicevox_engine/app/middlewares.py @@ -28,7 +28,9 @@ async def global_execution_handler(request: Request, exc: Exception) -> Response app.add_middleware(ServerErrorMiddleware, handler=global_execution_handler) # CORS用のヘッダを生成するミドルウェア - localhost_regex = r"^[a-zA-Z+\-\.]+://(([^/]+\.)localhost|127\.0\.0\.1|\[::1\])(:[0-9]+)?$" + localhost_regex = ( + r"^[a-zA-Z+\-\.]+://(([^/]+\.)localhost|127\.0\.0\.1|\[::1\])(:[0-9]+)?$" + ) compiled_localhost_regex = re.compile(localhost_regex) allowed_origins = ["*"] if cors_policy_mode == "localapps":