From 67766eefbb1b3727c96afe1287ced16eb12b550b Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Fri, 3 Nov 2023 15:23:21 +0800 Subject: [PATCH] Add an environment variable for the legacy rewrite rules that arent needed for local dev --- packages/web/next.config.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/packages/web/next.config.js b/packages/web/next.config.js index aa282657b..21ed643fa 100644 --- a/packages/web/next.config.js +++ b/packages/web/next.config.js @@ -24,6 +24,33 @@ const moduleExports = { 'proxy.omnivore-image-cache.app', ], }, + rewrites: () => + (process.env.INCLUDE_LEGACY_REWRITES + ? [ + { + source: '/api/graphql', + destination: `https://api-${process.env.NEXT_PUBLIC_APP_ENV}.omnivore.app/api/graphql`, + }, + { + source: '/api/auth/:path*', + destination: `https://api-${process.env.NEXT_PUBLIC_APP_ENV}.omnivore.app/api/auth/:path*`, + }, + { + source: '/api/article/save', + destination: `https://api-${process.env.NEXT_PUBLIC_APP_ENV}.omnivore.app/api/article/save`, + }, + { + source: '/api/mobile-auth/:path*', + destination: `https://api-${process.env.NEXT_PUBLIC_APP_ENV}.omnivore.app/api/mobile-auth/:path*`, + }, + ] + : []) + + [ + { + source: '/collect/:match*', + destination: 'https://app.posthog.com/:match*', + }, + ], async headers() { return [ {