Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Proper handling of requests to /health, /.well-known and ./assets in the vite dev setup (#6135)

Max Koretskyi33ee2fcb493a
diff --git a/frontend/vite.config.mts b/frontend/vite.config.mts
index 2626d1dae3..b102584eaf 100644
--- a/frontend/vite.config.mts
+++ b/frontend/vite.config.mts
@@ -19,6 +19,16 @@ const htmlDevPlugin = (): Plugin => {
return {
apply: "serve",
name: "html-transform",
+ configureServer(server) {
+ server.middlewares.use((req, res, next) => {
+ if (req.method === "GET" && req.url?.startsWith("/.well-known/")) {
+ res.statusCode = 404;
+ res.end("Not Found");
+ return;
+ }
+ next();
+ });
+ },
transformIndexHtml: async (html, ctx) => {
if (isStorybook) {
return html;
@@ -114,6 +124,10 @@ If the server is already running, make sure it is using port ${SERVER_PORT} with
const serverDoc = new JSDOM(serverHtml).window.document;
const devDoc = new JSDOM(html).window.document;
+ if (ctx.originalUrl?.startsWith("/health")) {
+ return serverHtml;
+ }
+
// Login page
if (!serverHtml.includes("marimo-mode") && serverHtml.includes("login")) {
return `
@@ -176,6 +190,12 @@ If the server is already running, make sure it is using port ${SERVER_PORT} with
// Copy scripts
const scripts = serverDoc.querySelectorAll("script");
scripts.forEach((script) => {
+ const src = script.getAttribute("src");
+
+ if (src && src.startsWith("./assets/")) {
+ return;
+ }
+
devDoc.head.append(script);
});