From 4926f6f62563727e783480a26dccf2ad78f0aa1f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 08:42:58 +0000 Subject: [PATCH] Fix env.js loading error by preventing catch-all from matching API routes Co-authored-by: whyour <22700758+whyour@users.noreply.github.com> --- back/loaders/express.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/back/loaders/express.ts b/back/loaders/express.ts index 63065a21..2a88d4cb 100644 --- a/back/loaders/express.ts +++ b/back/loaders/express.ts @@ -123,7 +123,11 @@ export default ({ app }: { app: Application }) => { app.use(rewrite('/open/*', '/api/$1')); app.use(config.api.prefix, routes()); - app.get('*', (_, res, next) => { + app.get('*', (req, res, next) => { + // Don't serve index.html for API routes + if (req.path.startsWith('/api/')) { + return next(); + } const indexPath = path.join(frontendPath, 'index.html'); res.sendFile(indexPath, (err) => { if (err) {