From bef8f8414baadacdfc86948e36ca2d97e38697c5 Mon Sep 17 00:00:00 2001 From: Mike Freno Date: Tue, 22 Sep 2026 16:38:43 -0400 Subject: [PATCH] utilization reduction --- public/robots.txt | 18 ++++++++++-- src/components/EdgeCacheHeaders.tsx | 29 +++++++++++++++++++ src/routes/[...404].tsx | 10 ++++++- src/routes/api/health.ts | 23 +++++++++++++++ src/routes/blog/[title]/index.tsx | 2 ++ src/routes/blog/index.tsx | 2 ++ src/routes/contact.tsx | 6 +++- src/routes/downloads.tsx | 2 ++ src/routes/gaze/contact.tsx | 2 ++ src/routes/gaze/downloads.tsx | 2 ++ src/routes/gaze/index.tsx | 2 ++ src/routes/gaze/privacy.tsx | 2 ++ src/routes/index.tsx | 2 ++ src/routes/inputhalo/contact.tsx | 2 ++ src/routes/inputhalo/downloads.tsx | 2 ++ src/routes/inputhalo/index.tsx | 2 ++ src/routes/inputhalo/privacy.tsx | 2 ++ src/routes/lineage/contact.tsx | 2 ++ src/routes/lineage/deletion.tsx | 2 ++ src/routes/lineage/downloads.tsx | 2 ++ src/routes/lineage/index.tsx | 2 ++ src/routes/lineage/privacy.tsx | 2 ++ src/routes/nessa/contact.tsx | 2 ++ src/routes/nessa/deletion.tsx | 2 ++ src/routes/nessa/index.tsx | 2 ++ src/routes/nessa/privacy.tsx | 2 ++ src/routes/nook/index.tsx | 2 ++ src/routes/nook/privacy.tsx | 2 ++ src/routes/privacy-policy/index.tsx | 2 ++ .../privacy-policy/shapes-with-abigail.tsx | 2 ++ src/routes/resume.tsx | 2 ++ 31 files changed, 133 insertions(+), 5 deletions(-) create mode 100644 src/components/EdgeCacheHeaders.tsx create mode 100644 src/routes/api/health.ts diff --git a/public/robots.txt b/public/robots.txt index 432a821..c97d49d 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,9 +1,21 @@ User-agent: * Allow: / Allow: /blog -Allow: /projects -Disallow: /login -Disallow: /debug/ + +# Private / dynamic paths — not for indexing. +# Keeps crawlers off auth, admin, and API pages so they don't burn +# uncached SSR function invocations. +Disallow: /account +Disallow: /analytics +Disallow: /api/ +Disallow: /blog/create +Disallow: /blog/edit +Disallow: /checkout Disallow: /databaseMGMT +Disallow: /debug/ +Disallow: /error-test +Disallow: /login +Disallow: /success +Disallow: /test Sitemap: https://www.freno.me/sitemap.xml diff --git a/src/components/EdgeCacheHeaders.tsx b/src/components/EdgeCacheHeaders.tsx new file mode 100644 index 0000000..66d8951 --- /dev/null +++ b/src/components/EdgeCacheHeaders.tsx @@ -0,0 +1,29 @@ +import { HttpHeader } from "@solidjs/start"; + +/** + * Renders edge-cache response headers for a page route. + * + * Sets `CDN-Cache-Control` so Vercel serves the rendered HTML from the edge + * (no origin re-render) for `maxAge` seconds, then stale-while-revalidate up + * to `staleSeconds`. `Cache-Control: public, max-age=0` keeps browsers + * revalidating, so visitors always get the latest version — only the CDN + * holds a cached copy. Function/CND-Cache-Control overrides the Vercel + * default, so repeated visits and bot crawls stop re-rendering at origin. + */ +export function EdgeCacheHeaders(props: { + /** Seconds the CDN may serve the response fresh. */ + maxAge: number; + /** Seconds the CDN serves stale while revalidating (default: 1 day). */ + staleSeconds?: number; +}) { + const stale = props.staleSeconds ?? 86400; + return ( + <> + + + + ); +} diff --git a/src/routes/[...404].tsx b/src/routes/[...404].tsx index 1d1690e..60db159 100644 --- a/src/routes/[...404].tsx +++ b/src/routes/[...404].tsx @@ -1,5 +1,5 @@ import { PageHead } from "~/components/PageHead"; -import { HttpStatusCode } from "@solidjs/start"; +import { HttpHeader, HttpStatusCode } from "@solidjs/start"; import { useLocation, useNavigate } from "@solidjs/router"; import { createSignal, onCleanup, onMount, Show } from "solid-js"; import { TerminalErrorPage } from "~/components/TerminalErrorPage"; @@ -90,6 +90,14 @@ export default function NotFound() { description="404 - Page not found. The page you're looking for doesn't exist." /> + {/* Cache 404/fallback responses at the edge (Vercel caches 404s) so + bots/monitors that probe dead paths don't re-render the full page + on every request. Function headers override vercel.json here. */} + + + + searchParams.viewer ?? "default"; return ( - + + (for this website or any of my apps...) @@ -134,6 +137,7 @@ function MainContactPage() { > + ); } diff --git a/src/routes/downloads.tsx b/src/routes/downloads.tsx index 9e929cc..cb729c9 100644 --- a/src/routes/downloads.tsx +++ b/src/routes/downloads.tsx @@ -1,4 +1,5 @@ import { PageHead } from "~/components/PageHead"; +import { EdgeCacheHeaders } from "~/components/EdgeCacheHeaders"; import { A } from "@solidjs/router"; import { createSignal, onMount, onCleanup, Switch, Match } from "solid-js"; import DownloadOnAppStore from "~/components/icons/DownloadOnAppStore"; @@ -71,6 +72,7 @@ function MainDownloadsPage() { return ( <> + + diff --git a/src/routes/gaze/downloads.tsx b/src/routes/gaze/downloads.tsx index e4ac04a..69bbd04 100644 --- a/src/routes/gaze/downloads.tsx +++ b/src/routes/gaze/downloads.tsx @@ -11,6 +11,7 @@ import { A } from "@solidjs/router"; import { createSignal } from "solid-js"; import { PageHead } from "~/components/PageHead"; +import { EdgeCacheHeaders } from "~/components/EdgeCacheHeaders"; import SubdomainHeader from "~/components/SubdomainHeader"; import DownloadOnAppStoreDark from "~/components/icons/DownloadOnAppStoreDark"; import Button from "~/components/ui/Button"; @@ -48,6 +49,7 @@ export default function GazeDownloadsPage() { return ( <> + + + + + diff --git a/src/routes/inputhalo/downloads.tsx b/src/routes/inputhalo/downloads.tsx index a9a06e4..d3c16d4 100644 --- a/src/routes/inputhalo/downloads.tsx +++ b/src/routes/inputhalo/downloads.tsx @@ -11,6 +11,7 @@ import { A } from "@solidjs/router"; import { createSignal } from "solid-js"; import { PageHead } from "~/components/PageHead"; +import { EdgeCacheHeaders } from "~/components/EdgeCacheHeaders"; import SubdomainHeader from "~/components/SubdomainHeader"; import DownloadOnAppStoreDark from "~/components/icons/DownloadOnAppStoreDark"; import Button from "~/components/ui/Button"; @@ -51,6 +52,7 @@ export default function InputHaloDownloadsPage() { return ( <> + + + + diff --git a/src/routes/lineage/deletion.tsx b/src/routes/lineage/deletion.tsx index 1104706..65abad8 100644 --- a/src/routes/lineage/deletion.tsx +++ b/src/routes/lineage/deletion.tsx @@ -33,6 +33,7 @@ * the form posts to the correct tRPC mutation (Lineage-branded email). */ import { PageHead } from "~/components/PageHead"; +import { EdgeCacheHeaders } from "~/components/EdgeCacheHeaders"; import SubdomainHeader from "~/components/SubdomainHeader"; import DeletionForm from "~/components/DeletionForm"; import { @@ -45,6 +46,7 @@ import { export default function LineageDeletionPage() { return ( <> +
diff --git a/src/routes/lineage/downloads.tsx b/src/routes/lineage/downloads.tsx index 146807e..1c43f8d 100644 --- a/src/routes/lineage/downloads.tsx +++ b/src/routes/lineage/downloads.tsx @@ -30,6 +30,7 @@ import { A } from "@solidjs/router"; import { createSignal, onMount, onCleanup } from "solid-js"; import { PageHead } from "~/components/PageHead"; +import { EdgeCacheHeaders } from "~/components/EdgeCacheHeaders"; import SubdomainHeader from "~/components/SubdomainHeader"; import DownloadOnAppStore from "~/components/icons/DownloadOnAppStore"; import Button from "~/components/ui/Button"; @@ -71,6 +72,7 @@ export default function LineageDownloadsPage() { return ( <> + diff --git a/src/routes/lineage/index.tsx b/src/routes/lineage/index.tsx index 9630553..51af782 100644 --- a/src/routes/lineage/index.tsx +++ b/src/routes/lineage/index.tsx @@ -11,6 +11,7 @@ */ import { A } from "@solidjs/router"; import { PageHead } from "~/components/PageHead"; +import { EdgeCacheHeaders } from "~/components/EdgeCacheHeaders"; import SubdomainHeader from "~/components/SubdomainHeader"; import SimpleParallax from "~/components/SimpleParallax"; import DownloadOnAppStoreDark from "~/components/icons/DownloadOnAppStoreDark"; @@ -25,6 +26,7 @@ import { export default function LineageLandingPage() { return ( <> + diff --git a/src/routes/lineage/privacy.tsx b/src/routes/lineage/privacy.tsx index 59a24b4..68196ed 100644 --- a/src/routes/lineage/privacy.tsx +++ b/src/routes/lineage/privacy.tsx @@ -17,11 +17,13 @@ */ import { A } from "@solidjs/router"; import { PageHead } from "~/components/PageHead"; +import { EdgeCacheHeaders } from "~/components/EdgeCacheHeaders"; import SubdomainHeader from "~/components/SubdomainHeader"; export default function LineagePrivacyPolicy() { return ( <> + + diff --git a/src/routes/nessa/deletion.tsx b/src/routes/nessa/deletion.tsx index 4420e2d..cbd0d2e 100644 --- a/src/routes/nessa/deletion.tsx +++ b/src/routes/nessa/deletion.tsx @@ -24,6 +24,7 @@ * Acceptance: `nessa.localhost:3000/deletion` renders the deletion form. */ import { PageHead } from "~/components/PageHead"; +import { EdgeCacheHeaders } from "~/components/EdgeCacheHeaders"; import SubdomainHeader from "~/components/SubdomainHeader"; import DeletionForm from "~/components/DeletionForm"; import { @@ -36,6 +37,7 @@ import { export default function NessaDeletionPage() { return ( <> +
diff --git a/src/routes/nessa/index.tsx b/src/routes/nessa/index.tsx index 69a1950..29ab55f 100644 --- a/src/routes/nessa/index.tsx +++ b/src/routes/nessa/index.tsx @@ -12,6 +12,7 @@ */ import { For, Show } from "solid-js"; import { PageHead } from "~/components/PageHead"; +import { EdgeCacheHeaders } from "~/components/EdgeCacheHeaders"; import SubdomainHeader from "~/components/SubdomainHeader"; import { useDarkMode } from "~/context/darkMode"; import { useSite } from "~/context/SiteContext"; @@ -59,6 +60,7 @@ export default function NessaLanding() { return ( <> + diff --git a/src/routes/nessa/privacy.tsx b/src/routes/nessa/privacy.tsx index 90bfccc..d491a34 100644 --- a/src/routes/nessa/privacy.tsx +++ b/src/routes/nessa/privacy.tsx @@ -29,11 +29,13 @@ */ import { A } from "@solidjs/router"; import { PageHead } from "~/components/PageHead"; +import { EdgeCacheHeaders } from "~/components/EdgeCacheHeaders"; import SubdomainHeader from "~/components/SubdomainHeader"; export default function NessaPrivacyPolicy() { return ( <> + + + + + +