fix: remove redirect, use proxied data

This commit is contained in:
Jack Merrill 2023-07-19 21:26:14 -05:00
parent d142db7fe4
commit 12cd9f4fe6
No known key found for this signature in database
GPG Key ID: B8E3CDF57DD80CA5
2 changed files with 13 additions and 9 deletions

View File

@ -3,15 +3,6 @@ const nextConfig = {
images: { images: {
domains: ["cdn.sanity.io"], 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; module.exports = nextConfig;

View File

@ -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 });
}