From f6be654573cb43c7467e665e98ed6611ca5adc87 Mon Sep 17 00:00:00 2001 From: TheFlow Date: Sat, 18 Apr 2026 07:41:29 +1200 Subject: [PATCH] =?UTF-8?q?fix(server):=20enable=20clean=20URLs=20(/whitep?= =?UTF-8?q?apers/foo=20=E2=86=92=20foo.html)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add extensions: ['html'] to express.static so the .html-less URLs resolve to their matching files. Affects every static HTML route including /whitepapers/distributive-equity, /whitepapers/eu-policy-brief, etc. .html-suffixed URLs continue to work unchanged. Non-existent paths still return the friendly 404 via the notFound middleware. --- src/server.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server.js b/src/server.js index c5968a34..1a434310 100644 --- a/src/server.js +++ b/src/server.js @@ -135,7 +135,9 @@ const rssRoutes = require('./routes/rss.routes'); app.use('/', rssRoutes); // Static files -app.use(express.static('public')); +// extensions: ['html'] lets clean URLs (e.g. /whitepapers/eu-policy-brief) resolve +// to the matching .html file. Without this, only the .html-suffixed URL works. +app.use(express.static('public', { extensions: ['html'] })); // Health check endpoint (minimal, no sensitive data) app.get('/health', (req, res) => {