Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Fix blank page on Windows due to broken .js MIME type (#4674)

Roland Tannousa6c1f893fc87
diff --git a/studio/backend/main.py b/studio/backend/main.py
index 65f5e7fe901..67908d8617c 100644
--- a/studio/backend/main.py
+++ b/studio/backend/main.py
@@ -23,10 +23,23 @@ if _backend_dir not in sys.path:
# See: https://github.com/python/cpython/issues/102396
import _platform_compat # noqa: F401
+import mimetypes
import shutil
import warnings
from contextlib import asynccontextmanager
+# Fix broken Windows registry MIME types. Some Windows installs map .js to
+# "text/plain" in the registry (HKCR\.js\Content Type). Python's mimetypes
+# module reads from the registry, and FastAPI/Starlette's StaticFiles uses
+# mimetypes.guess_type() to set Content-Type headers. Browsers enforce strict
+# MIME checking for ES module scripts (<script type="module">) and will refuse
+# to execute .js files served as text/plain — resulting in a blank page.
+# Calling add_type() *before* StaticFiles is instantiated ensures the correct
+# types are used regardless of the OS registry.
+if sys.platform == "win32":
+ mimetypes.add_type("application/javascript", ".js")
+ mimetypes.add_type("text/css", ".css")
+
# Suppress annoying dependency warnings in production
if os.getenv("ENVIRONMENT_TYPE", "production") == "production":
warnings.filterwarnings("ignore")