From 9506de28639a067cf0540aa1725586d15c9bcf2c Mon Sep 17 00:00:00 2001 From: "Nanashi." Date: Fri, 1 Nov 2024 12:19:07 +0900 Subject: [PATCH] =?UTF-8?q?localhost=E3=81=A8=E6=89=B1=E3=81=86URL?= =?UTF-8?q?=E3=81=AE=E7=A8=AE=E9=A1=9E=E3=82=92=E5=BA=83=E3=81=8F=E3=81=99?= =?UTF-8?q?=E3=82=8B=20(#1477)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Change: localhostの範囲を拡大 * Code: フォーマット --- 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 3c44a2125..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 = "^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":