Skip to content

Commit 68c4cd7

Browse files
Christian Shearerclaude
andcommitted
Add custom 404 page and redirect /pricing, /subscribe
Google Search Console flagged 404s on compute.regen.network. The server had no catch-all handler, so unknown paths returned Express's bare "Cannot GET" response. This adds: - 301 redirect /pricing → /#pricing (common guess) - 301 redirect GET /subscribe → /#pricing (POST-only route) - Branded 404 page matching the site's visual style Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7fa2009 commit 68c4cd7

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

src/server/index.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,44 @@ export function startServer(options: { port?: number; dbPath?: string } = {}) {
462462
checkCryptoRenewals().catch(console.error);
463463
}, 24 * 60 * 60 * 1000);
464464

465+
// --- Convenience redirects for commonly guessed URLs ---
466+
app.get("/pricing", (_req, res) => res.redirect(301, "/#pricing"));
467+
app.get("/subscribe", (_req, res) => res.redirect(301, "/#pricing"));
468+
469+
// --- Custom 404 handler (must be last) ---
470+
app.use((_req, res) => {
471+
res.status(404).send(`<!DOCTYPE html>
472+
<html lang="en">
473+
<head>
474+
<meta charset="utf-8"/>
475+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
476+
<title>Page Not Found — Regenerative Compute</title>
477+
<style>
478+
*{margin:0;padding:0;box-sizing:border-box}
479+
body{min-height:100vh;display:flex;align-items:center;justify-content:center;
480+
font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
481+
background:linear-gradient(135deg,#0a3d2e 0%,#0d6b52 50%,#0f5a4a 100%);color:#fff}
482+
.container{text-align:center;padding:2rem;max-width:480px}
483+
h1{font-size:5rem;font-weight:200;opacity:0.3;margin-bottom:0.5rem}
484+
h2{font-size:1.5rem;font-weight:400;margin-bottom:1rem}
485+
p{opacity:0.8;margin-bottom:2rem;line-height:1.6}
486+
a{display:inline-block;padding:0.75rem 2rem;background:rgba(255,255,255,0.15);
487+
color:#fff;text-decoration:none;border-radius:8px;border:1px solid rgba(255,255,255,0.25);
488+
transition:background 0.2s}
489+
a:hover{background:rgba(255,255,255,0.25)}
490+
</style>
491+
</head>
492+
<body>
493+
<div class="container">
494+
<h1>404</h1>
495+
<h2>Page not found</h2>
496+
<p>The page you're looking for doesn't exist. It may have been moved or removed.</p>
497+
<a href="/">Back to Regenerative Compute</a>
498+
</div>
499+
</body>
500+
</html>`);
501+
});
502+
465503
app.listen(port, () => {
466504
console.log(`Regenerative Compute server running on ${baseUrl}`);
467505
console.log(` Certificates: ${baseUrl}/impact/:nodeId`);

0 commit comments

Comments
 (0)