From f3087b9cae4edcd40dc4779912149889772b939b Mon Sep 17 00:00:00 2001 From: capJavert Date: Fri, 22 Nov 2024 15:06:21 +0100 Subject: [PATCH] feat: cf rewrite --- packages/webapp/next.config.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/webapp/next.config.ts b/packages/webapp/next.config.ts index d142f9a61f..66117b98d2 100644 --- a/packages/webapp/next.config.ts +++ b/packages/webapp/next.config.ts @@ -105,6 +105,19 @@ const nextConfig: NextConfig = { CURRENT_VERSION: version, }, rewrites: async () => { + if (process.env.VERCEL_ENV) { + return { + beforeFiles: [ + { + source: '/:path*', + destination: `${process.env.CF_DEPLOYMENT_URL}/:path*`, + }, + ], + afterFiles: [], + fallback: [], + }; + } + const rewrites: Rewrite[] = [ { source: '/api/sitemaps/:path*',