diff --git a/packages/webapp/components/layouts/ProfileLayout/index.tsx b/packages/webapp/components/layouts/ProfileLayout/index.tsx index d6196de5ec..290cba0dfa 100644 --- a/packages/webapp/components/layouts/ProfileLayout/index.tsx +++ b/packages/webapp/components/layouts/ProfileLayout/index.tsx @@ -128,7 +128,7 @@ interface ProfileParams extends ParsedUrlQuery { } export async function getStaticPaths(): Promise { - return { paths: [], fallback: true }; + return { paths: [], fallback: 'blocking' }; } export async function getStaticProps({ diff --git a/packages/webapp/next.config.ts b/packages/webapp/next.config.ts index d57dc114f5..79f8282bc2 100644 --- a/packages/webapp/next.config.ts +++ b/packages/webapp/next.config.ts @@ -125,6 +125,24 @@ const nextConfig: NextConfig = { }, ]; + if (process.env.REWRITE_DEPLOYMENT_URL) { + return { + beforeFiles: [ + { + source: '/:path*', + destination: `${process.env.REWRITE_DEPLOYMENT_URL}/:path*`, + }, + ], + afterFiles: rewrites, + fallback: [ + { + source: '/:path*', + destination: `${process.env.REWRITE_DEPLOYMENT_URL}/:path*`, + }, + ], + }; + } + // to support GitPod environment and avoid CORS issues, we need to proxy the API requests if (process.env.NEXT_PUBLIC_DOMAIN === 'localhost') { rewrites.unshift({ @@ -181,6 +199,9 @@ const nextConfig: NextConfig = { poweredByHeader: false, reactStrictMode: false, productionBrowserSourceMaps: process.env.SOURCE_MAPS === 'true', + generateBuildId: async () => { + return process.env.COMMIT_REF || process.env.VERCEL_GIT_COMMIT_SHA; + }, }), }), }; diff --git a/packages/webapp/pages/backoffice/keywords/[value].tsx b/packages/webapp/pages/backoffice/keywords/[value].tsx index ebe71f6332..c3ddd6b182 100644 --- a/packages/webapp/pages/backoffice/keywords/[value].tsx +++ b/packages/webapp/pages/backoffice/keywords/[value].tsx @@ -51,7 +51,7 @@ KeywordPage.getLayout = getMainLayout; export default KeywordPage; export async function getStaticPaths(): Promise { - return { paths: [], fallback: true }; + return { paths: [], fallback: 'blocking' }; } interface KeywordParams extends ParsedUrlQuery { diff --git a/packages/webapp/pages/posts/[id]/index.tsx b/packages/webapp/pages/posts/[id]/index.tsx index 136088967c..abc33d58c8 100644 --- a/packages/webapp/pages/posts/[id]/index.tsx +++ b/packages/webapp/pages/posts/[id]/index.tsx @@ -182,7 +182,7 @@ PostPage.layoutProps = { export default PostPage; export async function getStaticPaths(): Promise { - return { paths: [], fallback: true }; + return { paths: [], fallback: 'blocking' }; } export async function getStaticProps({ diff --git a/packages/webapp/pages/sources/[source].tsx b/packages/webapp/pages/sources/[source].tsx index 0d59b7b524..c01b6884bd 100644 --- a/packages/webapp/pages/sources/[source].tsx +++ b/packages/webapp/pages/sources/[source].tsx @@ -255,7 +255,7 @@ SourcePage.layoutProps = { export default SourcePage; export async function getStaticPaths(): Promise { - return { paths: [], fallback: true }; + return { paths: [], fallback: 'blocking' }; } interface SourcePageParams extends ParsedUrlQuery { diff --git a/packages/webapp/pages/squads/[handle]/[token].tsx b/packages/webapp/pages/squads/[handle]/[token].tsx index 1f9205b1e3..3ff38d07d9 100644 --- a/packages/webapp/pages/squads/[handle]/[token].tsx +++ b/packages/webapp/pages/squads/[handle]/[token].tsx @@ -300,7 +300,7 @@ SquadReferral.layoutProps = { showSidebar: false }; export default SquadReferral; export async function getStaticPaths(): Promise { - return { paths: [], fallback: true }; + return { paths: [], fallback: 'blocking' }; } export async function getStaticProps({ diff --git a/packages/webapp/pages/squads/[handle]/edit.tsx b/packages/webapp/pages/squads/[handle]/edit.tsx index 143f2d22c1..93a3cc75de 100644 --- a/packages/webapp/pages/squads/[handle]/edit.tsx +++ b/packages/webapp/pages/squads/[handle]/edit.tsx @@ -115,7 +115,7 @@ EditSquad.getLayout = getMainLayout; EditSquad.layoutProps = { seo }; export async function getStaticPaths(): Promise { - return { paths: [], fallback: true }; + return { paths: [], fallback: 'blocking' }; } interface SquadPageParams extends ParsedUrlQuery { diff --git a/packages/webapp/pages/squads/[handle]/moderate.tsx b/packages/webapp/pages/squads/[handle]/moderate.tsx index 2625dee253..090c8a7dff 100644 --- a/packages/webapp/pages/squads/[handle]/moderate.tsx +++ b/packages/webapp/pages/squads/[handle]/moderate.tsx @@ -76,7 +76,7 @@ export default function ModerateSquadPage({ } export async function getStaticPaths(): Promise { - return { paths: [], fallback: true }; + return { paths: [], fallback: 'blocking' }; } interface SquadPageParams extends ParsedUrlQuery { diff --git a/packages/webapp/pages/tags/[tag].tsx b/packages/webapp/pages/tags/[tag].tsx index a5ff317851..928145a108 100644 --- a/packages/webapp/pages/tags/[tag].tsx +++ b/packages/webapp/pages/tags/[tag].tsx @@ -346,7 +346,7 @@ TagPage.layoutProps = mainFeedLayoutProps; export default TagPage; export async function getStaticPaths(): Promise { - return { paths: [], fallback: true }; + return { paths: [], fallback: 'blocking' }; } interface TagPageParams extends ParsedUrlQuery {