From 9660a28dbf2e273bc017bbd53906610686980448 Mon Sep 17 00:00:00 2001 From: Shahanur Islam Shagor Date: Wed, 19 Aug 2026 16:26:41 +0300 Subject: [PATCH 1/2] Fix standalone admin page routing in Node production server --- backend/server/server.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/backend/server/server.js b/backend/server/server.js index 39eff5c0..0a3a40ea 100644 --- a/backend/server/server.js +++ b/backend/server/server.js @@ -116,10 +116,18 @@ const matchesPath = (pathname = '', target = '') => { const configuredAdminHostname = getHostnameFromOrigin(getAdminOrigin()); const getRequestHostname = (req) => String(req.hostname || req.headers.host || '').split(':')[0].toLowerCase(); +const adminStandalonePages = new Map([ + ['admin/storage', 'storage.html'], + ['admin/calling', 'calling.html'], + ['admin/calling-push', 'calling-push.html'], + ['admin/social-auth', 'social-auth.html'], +]); + if (!config.isDev && config.serveFrontend) { const publicRoot = path.resolve(__dirname, '..', '..', 'frontend', 'client', 'public'); const clientIndex = path.join(publicRoot, 'index.html'); - const adminIndex = path.join(publicRoot, 'admin', 'index.html'); + const adminRoot = path.join(publicRoot, 'admin'); + const adminIndex = path.join(adminRoot, 'index.html'); const hasFrontendBuild = fs.existsSync(clientIndex) && fs.existsSync(adminIndex); if (!hasFrontendBuild) { console.warn('[startup] Frontend build files were not found. Client/admin routes will not be available.'); @@ -133,6 +141,16 @@ if (!config.isDev && config.serveFrontend) { res.status(404).send('Not found'); return; } + + const standaloneAdminFile = adminStandalonePages.get(pathname); + if (standaloneAdminFile) { + const standalonePath = path.join(adminRoot, standaloneAdminFile); + if (fs.existsSync(standalonePath)) { + res.sendFile(standalonePath); + return; + } + } + if (isAdminHost || matchesPath(pathname, 'admin')) { res.sendFile(adminIndex); return; From 38c682ae5d6d34a1d450377e11d9a39156cc6566 Mon Sep 17 00:00:00 2001 From: Shahanur Islam Shagor Date: Wed, 19 Aug 2026 16:27:10 +0300 Subject: [PATCH 2/2] Route standalone admin pages before SPA fallback --- frontend/.htaccess | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/.htaccess b/frontend/.htaccess index 0e9fe4fe..aa3168f6 100644 --- a/frontend/.htaccess +++ b/frontend/.htaccess @@ -3,6 +3,13 @@ RewriteEngine On # If Apache is serving this repository root, route public web requests # to the generated frontend assets under client/public. +# Standalone admin pages are separate webpack entry points. Resolve their +# extensionless URLs before the generic admin SPA fallback. +RewriteRule ^admin/storage/?$ client/public/admin/storage.html [L] +RewriteRule ^admin/calling/?$ client/public/admin/calling.html [L] +RewriteRule ^admin/calling-push/?$ client/public/admin/calling-push.html [L] +RewriteRule ^admin/social-auth/?$ client/public/admin/social-auth.html [L] + # Admin subdomain SPA entry. RewriteCond %{HTTP_HOST} ^admin\. [NC] RewriteCond %{REQUEST_URI} !^/client/public/