From 34dd3788fc2d983d50e674b33e0ef54ce2557d98 Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Fri, 11 Apr 2025 16:33:17 -0400 Subject: [PATCH] set `x-vercel-enable-rewrite-caching` header --- next.config.ts | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/next.config.ts b/next.config.ts index c0fc1f9a..2d62c922 100644 --- a/next.config.ts +++ b/next.config.ts @@ -74,7 +74,7 @@ const nextConfig: NextConfig = { headers: [ { key: "strict-transport-security", - value: "max-age=63072000; includeSubDomains; preload", + value: "max-age=63072000", }, { // 🥛 debugging @@ -83,6 +83,33 @@ const nextConfig: NextConfig = { }, ], }, + { + source: "/_stream/(.*)", + headers: [ + { + // https://vercel.com/docs/rewrites#caching-rewrites + key: "x-vercel-enable-rewrite-caching", + value: "1", + }, + ], + }, + ...(process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID + ? [ + { + source: "/_stream/u/api/send", + headers: [ + { + key: "cache-control", + value: "no-cache, no-store", + }, + { + key: "x-vercel-enable-rewrite-caching", + value: "0", + }, + ], + }, + ] + : []), ...(process.env.NEXT_PUBLIC_ONION_DOMAIN ? [ { @@ -99,15 +126,6 @@ const nextConfig: NextConfig = { }, ] : []), - { - source: "/tweets(|/.*)", - headers: [ - { - key: "x-robots-tag", - value: "noindex, nofollow, nosnippet", - }, - ], - }, ], rewrites: async () => [ ...(process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID @@ -124,11 +142,6 @@ const nextConfig: NextConfig = { source: "/tweets/:path*", destination: "https://tweets-khaki.vercel.app/:path*", }, - { - source: "/pubkey.asc", - destination: - "https://keys.openpgp.org/pks/lookup?op=get&options=mr&search=0x3bc6e5776bf379d36f6714802b0c9cf251e69a39", - }, ], redirects: async () => [ { source: "/y2k", destination: "https://y2k.pages.dev", permanent: false }, @@ -137,6 +150,12 @@ const nextConfig: NextConfig = { destination: "https://umami-wine-eight.vercel.app/share/wwTaTpLgC6gP9VyX/jarv.is", permanent: false, }, + { + source: "/pubkey.asc", + destination: + "https://keys.openpgp.org/pks/lookup?op=get&options=mr&search=0x3bc6e5776bf379d36f6714802b0c9cf251e69a39", + permanent: false, + }, // NOTE: don't remove this, it ensures de-AMPing the site hasn't offended our google overlords too badly! // https://developers.google.com/search/docs/advanced/experience/remove-amp#remove-only-amp