🔧 Rewrite viewer to landing-page
This commit is contained in:
@ -3,14 +3,6 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
|||||||
enabled: process.env.ANALYZE === 'true',
|
enabled: process.env.ANALYZE === 'true',
|
||||||
})
|
})
|
||||||
|
|
||||||
const pages = [
|
|
||||||
'pricing',
|
|
||||||
'privacy-policies',
|
|
||||||
'terms-of-service',
|
|
||||||
'about',
|
|
||||||
'oss-friends',
|
|
||||||
]
|
|
||||||
|
|
||||||
module.exports = withBundleAnalyzer({
|
module.exports = withBundleAnalyzer({
|
||||||
transpilePackages: ['utils', 'models'],
|
transpilePackages: ['utils', 'models'],
|
||||||
async redirects() {
|
async redirects() {
|
||||||
@ -28,36 +20,4 @@ module.exports = withBundleAnalyzer({
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
async rewrites() {
|
|
||||||
return {
|
|
||||||
beforeFiles: [
|
|
||||||
{
|
|
||||||
source: '/_next/static/:static*',
|
|
||||||
destination:
|
|
||||||
process.env.NEXT_PUBLIC_VIEWER_URL + '/_next/static/:static*',
|
|
||||||
has: [
|
|
||||||
{
|
|
||||||
type: 'header',
|
|
||||||
key: 'referer',
|
|
||||||
value:
|
|
||||||
process.env.LANDING_PAGE_HOST +
|
|
||||||
'/(?!' +
|
|
||||||
pages.join('|') +
|
|
||||||
'|\\?).+',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
fallback: [
|
|
||||||
{
|
|
||||||
source: '/:typebotId*',
|
|
||||||
destination: process.env.NEXT_PUBLIC_VIEWER_URL + '/:typebotId*',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: '/api/:path*',
|
|
||||||
destination: process.env.NEXT_PUBLIC_VIEWER_URL + '/api/:path*',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
const { withSentryConfig } = require('@sentry/nextjs')
|
const { withSentryConfig } = require('@sentry/nextjs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
|
const landingPagePaths = [
|
||||||
|
'/',
|
||||||
|
'/pricing',
|
||||||
|
'/privacy-policies',
|
||||||
|
'/terms-of-service',
|
||||||
|
'/about',
|
||||||
|
'/oss-friends',
|
||||||
|
]
|
||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
@ -14,13 +23,59 @@ const nextConfig = {
|
|||||||
outputFileTracingRoot: path.join(__dirname, '../../'),
|
outputFileTracingRoot: path.join(__dirname, '../../'),
|
||||||
},
|
},
|
||||||
async rewrites() {
|
async rewrites() {
|
||||||
return [
|
return {
|
||||||
{
|
beforeFiles: (process.env.LANDING_PAGE_URL
|
||||||
|
? landingPagePaths
|
||||||
|
.map((path) => ({
|
||||||
|
source: '/_next/static/:static*',
|
||||||
|
destination: `${process.env.LANDING_PAGE_URL}/_next/static/:static*`,
|
||||||
|
has: [
|
||||||
|
{
|
||||||
|
type: 'header',
|
||||||
|
key: 'referer',
|
||||||
|
value: `${process.env.NEXT_PUBLIC_VIEWER_URL}${path}`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}))
|
||||||
|
.concat(
|
||||||
|
landingPagePaths.map((path) => ({
|
||||||
|
source: '/typebots/:typebot*',
|
||||||
|
destination: `${process.env.LANDING_PAGE_URL}/typebots/:typebot*`,
|
||||||
|
has: [
|
||||||
|
{
|
||||||
|
type: 'header',
|
||||||
|
key: 'referer',
|
||||||
|
value: `${process.env.NEXT_PUBLIC_VIEWER_URL}${path}`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
.concat(
|
||||||
|
landingPagePaths.map((path) => ({
|
||||||
|
source: '/styles/:style*',
|
||||||
|
destination: `${process.env.LANDING_PAGE_URL}/styles/:style*`,
|
||||||
|
has: [
|
||||||
|
{
|
||||||
|
type: 'header',
|
||||||
|
key: 'referer',
|
||||||
|
value: `${process.env.NEXT_PUBLIC_VIEWER_URL}${path}`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
.concat(
|
||||||
|
landingPagePaths.map((path) => ({
|
||||||
|
source: path,
|
||||||
|
destination: `${process.env.LANDING_PAGE_URL}${path}`,
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
: []
|
||||||
|
).concat({
|
||||||
source: '/api/typebots/:typebotId/blocks/:blockId/storage/upload-url',
|
source: '/api/typebots/:typebotId/blocks/:blockId/storage/upload-url',
|
||||||
destination:
|
destination:
|
||||||
'/api/v1/typebots/:typebotId/blocks/:blockId/storage/upload-url',
|
'/api/v1/typebots/:typebotId/blocks/:blockId/storage/upload-url',
|
||||||
},
|
}),
|
||||||
]
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user