tfrere HF Staff commited on
Commit
5d44891
·
1 Parent(s): c353d31

fix: prevent express.static from serving index.html on /

Browse files

express.static was intercepting GET / and serving the SPA before
the route handlers could check auth. Use { index: false } so only
JS/CSS/assets are served statically; index.html routing is handled
explicitly by /editor and the catch-all.

Made-with: Cursor

Files changed (1) hide show
  1. backend/src/server.ts +2 -1
backend/src/server.ts CHANGED
@@ -292,7 +292,8 @@ function sendLoginPage(res: express.Response) {
292
  }
293
 
294
  if (existsSync(staticDir)) {
295
- app.use(express.static(staticDir));
 
296
 
297
  // GET /editor → requires auth, serves the SPA
298
  app.get("/editor", async (req, res) => {
 
292
  }
293
 
294
  if (existsSync(staticDir)) {
295
+ // Serve JS/CSS/assets but NOT index.html (routing handles that)
296
+ app.use(express.static(staticDir, { index: false }));
297
 
298
  // GET /editor → requires auth, serves the SPA
299
  app.get("/editor", async (req, res) => {