diff --git a/next.config.js b/next.config.js index 2e34c74..3dcc307 100644 --- a/next.config.js +++ b/next.config.js @@ -3,15 +3,6 @@ const nextConfig = { images: { domains: ["cdn.sanity.io"], }, - async redirects() { - return [ - { - source: "/.well-known/matrix/:slug*", - destination: "https://matrix.jackmerrill.com/.well-known/matrix/:slug*", - permanent: true, - }, - ]; - }, }; module.exports = nextConfig; diff --git a/src/app/.well-known/matrix/[slug]/route.ts b/src/app/.well-known/matrix/[slug]/route.ts new file mode 100644 index 0000000..af6b48e --- /dev/null +++ b/src/app/.well-known/matrix/[slug]/route.ts @@ -0,0 +1,13 @@ +export async function GET( + request: Request, + { params }: { params: { slug: string } } +) { + const slug = params.slug; // 'server', 'client', or 'support' for Matrix + + const response = await fetch( + `https://matrix.jackmerrill.com/.well-known/matrix/${slug}` + ); + const headers = { "content-type": "application/json" }; + const body = JSON.stringify(await response.json()); + return new Response(body, { headers }); +}