[object Object]

← back to Ventura Claw

/services + /legal-notice + /how-it-works: emit real Last-Modified header (from underlying HTML mtime) + Cache-Control: public, max-age=300, must-revalidate; CDN/proxy cache hint after the post-pivot copy sweep

246100555734608e6e8052501da7062ee00a725b · 2026-05-07 09:25:45 -0700 · Steve

Files touched

Diff

commit 246100555734608e6e8052501da7062ee00a725b
Author: Steve <steve@designerwallcoverings.com>
Date:   Thu May 7 09:25:45 2026 -0700

    /services + /legal-notice + /how-it-works: emit real Last-Modified header (from underlying HTML mtime) + Cache-Control: public, max-age=300, must-revalidate; CDN/proxy cache hint after the post-pivot copy sweep
---
 server/server.js | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/server/server.js b/server/server.js
index c98d6fd..563cc54 100644
--- a/server/server.js
+++ b/server/server.js
@@ -537,9 +537,22 @@ app.get("/", (req, res) => {
   res.sendFile(path.join(PUB, "homepage.html"));
 });
 app.get("/login",   (req, res) => res.sendFile(path.join(PUB, "login.html")));
-app.get("/services",      (req, res) => res.sendFile(path.join(PUB, "services.html")));
-app.get("/legal-notice",  (req, res) => res.sendFile(path.join(PUB, "legal-notice.html")));
-app.get("/how-it-works",  (req, res) => res.sendFile(path.join(PUB, "how-it-works.html")));
+// Helper: serve a static HTML file with a real Last-Modified header (CDN/proxy cache hint).
+// Express's sendFile sets Last-Modified by default when serving static files via res.sendFile +
+// `lastModified: true`, but only when the file is served as a static asset; explicit routes
+// don't get it automatically. This helper closes that gap.
+function _sendHtmlWithLM(res, filename) {
+  const fp = path.join(PUB, filename);
+  try {
+    const lm = fs.statSync(fp).mtime.toUTCString();
+    res.setHeader("Last-Modified", lm);
+    res.setHeader("Cache-Control", "public, max-age=300, must-revalidate");
+  } catch {}
+  return res.sendFile(fp);
+}
+app.get("/services",      (req, res) => _sendHtmlWithLM(res, "services.html"));
+app.get("/legal-notice",  (req, res) => _sendHtmlWithLM(res, "legal-notice.html"));
+app.get("/how-it-works",  (req, res) => _sendHtmlWithLM(res, "how-it-works.html"));
 app.get("/chat",        requireAuthPage, (req, res) => res.sendFile(path.join(PUB, "chat.html")));
 app.get("/connections", requireAuthPage, (req, res) => res.sendFile(path.join(PUB, "connections.html")));
 app.get("/connections/import", requireAuthPage, (req, res) => res.sendFile(path.join(PUB, "connections-import.html")));

← b2b64af /docs: add curl example for /api/public/services (18-row ser  ·  back to Ventura Claw  ·  /services + /legal-notice + /how-it-works: dark/light theme b2a4b3b →