mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Add an environment variable to conditionally use legacy rewrites
These rewrites are not needed in dev, but in demo/production we should keep them for some older clients still.
This commit is contained in:
parent
67766eefbb
commit
556fa60fc9
1 changed files with 28 additions and 27 deletions
|
|
@ -24,33 +24,34 @@ 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*',
|
||||
},
|
||||
],
|
||||
rewrites: () => {
|
||||
const rewrites = []
|
||||
if (process.env.INCLUDE_LEGACY_REWRITES) {
|
||||
rewrites.push(
|
||||
{
|
||||
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*`,
|
||||
}
|
||||
)
|
||||
}
|
||||
rewrites.push({
|
||||
source: '/collect/:match*',
|
||||
destination: 'https://app.posthog.com/:match*',
|
||||
})
|
||||
return rewrites
|
||||
},
|
||||
async headers() {
|
||||
return [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue