more error handling

This commit is contained in:
2025-03-31 09:15:40 -04:00
parent 50c184fb21
commit ec7c9fae54
15 changed files with 114 additions and 143 deletions
+23 -17
View File
@@ -58,7 +58,23 @@ const nextConfig: NextConfig = {
},
headers: async () => [
{
// matches any path without a file extension (aka period) or an underscore (e.g. /_next/image)
// matches any path
source: "/(.*)",
headers: [
{
key: "strict-transport-security",
value: "max-age=63072000; includeSubDomains; preload",
},
{
key: "x-got-milk",
value: "2%",
},
],
},
{
// https://community.torproject.org/onion-services/advanced/onion-location/
// only needed on actual pages, not static assets, so make a best effort by matching any path **without** a file
// extension (aka a period) and/or an underscore (e.g. /_next/image).
source: "/:path([^._]*)",
headers: [
{
@@ -67,15 +83,6 @@ const nextConfig: NextConfig = {
},
],
},
{
source: "/pubkey.asc",
headers: [
{
key: "Content-Type",
value: "text/plain; charset=utf-8",
},
],
},
],
rewrites: async () => [
{
@@ -88,6 +95,11 @@ 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 },
@@ -231,10 +243,4 @@ const nextPlugins: Array<
// eslint-disable-next-line import/no-anonymous-default-export
export default (): NextConfig =>
nextPlugins.reduce((acc, next) => {
if (Array.isArray(next)) {
return next[0](acc, next[1]);
}
return next(acc);
}, nextConfig);
nextPlugins.reduce((acc, plugin) => (Array.isArray(plugin) ? plugin[0](acc, plugin[1]) : plugin(acc)), nextConfig);