openvibers/openvibe.live Commits

Serve "/" through the renderer for every client, not only Accept: text/html

OP OpenVibers committed 17 Sept 2026 · 1ac10d504b · 2 files, +10 −1

The public static mount answered "/" with the raw index.html (no content
hashes, route assets or manifest) whenever the SEO middleware passed — any
request whose Accept header lacks text/html.

Changes

ddiff --git a/server/index.js b/server/index.js
iindex 2de6676a..a0ffc9e8 100644
---- a/server/index.js
++++ b/server/index.js
@@@ -535,7 +535,9 @@ app.use((req, res, next) => {
if ((req.method !== 'GET' && req.method !== 'HEAD') || !req.path.endsWith('.html')) return next();
if (!sendDocument(res, req.path.slice(1))) return next();
});
--app.use(express.static(assets.PUBLIC_DIR, { setHeaders: (res, filePath) => { if (filePath.endsWith('.html')) noCacheHeaders(res); } }));
++// index: false — "/" must reach sendDocument (the SPA fallback), never the raw index.html with its
++// unfilled route markers and unversioned asset URLs (a request without Accept: text/html skips SEO).
++app.use(express.static(assets.PUBLIC_DIR, { index: false, setHeaders: (res, filePath) => { if (filePath.endsWith('.html')) noCacheHeaders(res); } }));
// Ensure data directories exist. VOD/clip/paste/thumbnail files live in
// OpenVibe.Media now; what remains is Live-local state (live thumbs, emotes,
ddiff --git a/test/asset-versioning.test.js b/test/asset-versioning.test.js
iindex 417d86e7..19b136eb 100644
---- a/test/asset-versioning.test.js
++++ b/test/asset-versioning.test.js
@@@ -122,6 +122,13 @@ async function check(name, fn) {
}
});
++ await check('the public static mount never serves index.html for "/" (it would skip rendering)', () => {
++ const src = fs.readFileSync(path.join(__dirname, '../server/index.js'), 'utf8');
++ const mount = src.match(/app\.use\(express\.static\(assets\.PUBLIC_DIR,[^\n]*/);
++ assert.ok(mount, 'root static mount not found');
++ assert.match(mount[0], /index:\s*false/);
++ });
++
server.close();
fs.rmSync(base, { recursive: true, force: true });
if (failures) { console.log(`\n${failures} failure(s)`); process.exit(1); }