Skip to content

Commit 7388c57

Browse files
authored
fix: remove docs rewrites from www preview (supabase#38986)
Preview sites are being crawled because the rewrite causes the docs production content (which naturally has `index, follow`) to be served under the www preview domain. We shouldn’t be rewriting in any environment except production.
1 parent c03343d commit 7388c57

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

apps/www/lib/rewrites.js

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = [
1+
const rewrites = [
22
{
33
source: '/:path*',
44
destination: `/:path*`,
@@ -11,21 +11,16 @@ module.exports = [
1111
source: '/dashboard/:path*',
1212
destination: `${process.env.NEXT_PUBLIC_STUDIO_URL}/:path*`,
1313
},
14-
{
15-
source: '/docs',
16-
destination: `${process.env.NEXT_PUBLIC_DOCS_URL}`,
17-
},
18-
{
19-
// redirect /docs/
20-
// trailing slash caused by docusaurus issue with multizone
21-
source: '/docs/',
22-
destination: `${process.env.NEXT_PUBLIC_DOCS_URL}`,
23-
},
24-
{
25-
source: '/docs/:path*',
26-
destination: `${process.env.NEXT_PUBLIC_DOCS_URL}/:path*`,
27-
},
28-
14+
...(process.env.NEXT_PUBLIC_VERCEL_ENV === 'production'
15+
? [
16+
{ source: '/docs', destination: `${process.env.NEXT_PUBLIC_DOCS_URL}` },
17+
{
18+
source: '/docs/',
19+
destination: `${process.env.NEXT_PUBLIC_DOCS_URL}`,
20+
},
21+
{ source: '/docs/:path*', destination: `${process.env.NEXT_PUBLIC_DOCS_URL}/:path*` },
22+
]
23+
: []),
2924
{
3025
source: '/ui',
3126
destination: `${process.env.NEXT_PUBLIC_UI_LIBRARY_URL}`,
@@ -70,8 +65,7 @@ module.exports = [
7065
source: '/llms/:path(.*\\.txt$)',
7166
destination: `${process.env.NEXT_PUBLIC_DOCS_URL}/llms/:path`,
7267
},
73-
{
74-
source: '/feed.xml',
75-
destination: `/rss.xml`,
76-
},
68+
{ source: '/feed.xml', destination: `/rss.xml` },
7769
]
70+
71+
module.exports = rewrites

0 commit comments

Comments
 (0)