From 65fdc108a89ace0114451fa387dc0a3f003e7915 Mon Sep 17 00:00:00 2001 From: Plena Finance Dev Date: Thu, 9 Jul 2026 11:55:31 +0530 Subject: [PATCH] fix(mobile): move baseUrl config to experiments.baseUrl and filter static assets in express wildcard handler --- backend/src/index.ts | 8 ++++++++ mobile/app.json | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index a371332..b485ae9 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -49,6 +49,14 @@ app.get('/{*path}', (req, res, next) => { if (req.path.startsWith(apiRoot)) return next(); if (req.path === '/_cron/tick') return next(); + // Do not serve HTML for static assets or requests that do not accept HTML + const isAsset = /\.[a-z0-9]{2,4}$/i.test(req.path); + const acceptsHtml = req.headers.accept?.includes('text/html'); + if (isAsset || !acceptsHtml) { + res.status(404).json({ success: false, error: 'Not found' }); + return; + } + if (req.path.startsWith('/mobile')) { res.sendFile(path.join(publicDir, 'mobile/index.html'), (err) => { if (err) next(); diff --git a/mobile/app.json b/mobile/app.json index 2ffc6b8..944c4e8 100644 --- a/mobile/app.json +++ b/mobile/app.json @@ -23,8 +23,7 @@ "web": { "bundler": "metro", "output": "single", - "favicon": "./assets/images/favicon.png", - "baseUrl": "/mobile" + "favicon": "./assets/images/favicon.png" }, "plugins": [ "expo-router", @@ -32,7 +31,8 @@ "expo-web-browser" ], "experiments": { - "typedRoutes": true + "typedRoutes": true, + "baseUrl": "/mobile" } } } \ No newline at end of file