Files
supabase/apps/www/lib/rewrites.js
Charis 7388c57862 fix: remove docs rewrites from www preview (#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.
2025-09-25 13:45:36 -04:00

72 lines
1.9 KiB
JavaScript

const rewrites = [
{
source: '/:path*',
destination: `/:path*`,
},
{
source: '/dashboard',
destination: `${process.env.NEXT_PUBLIC_STUDIO_URL}`,
},
{
source: '/dashboard/:path*',
destination: `${process.env.NEXT_PUBLIC_STUDIO_URL}/:path*`,
},
...(process.env.NEXT_PUBLIC_VERCEL_ENV === 'production'
? [
{ source: '/docs', destination: `${process.env.NEXT_PUBLIC_DOCS_URL}` },
{
source: '/docs/',
destination: `${process.env.NEXT_PUBLIC_DOCS_URL}`,
},
{ source: '/docs/:path*', destination: `${process.env.NEXT_PUBLIC_DOCS_URL}/:path*` },
]
: []),
{
source: '/ui',
destination: `${process.env.NEXT_PUBLIC_UI_LIBRARY_URL}`,
},
{
source: '/ui/:path*',
destination: `${process.env.NEXT_PUBLIC_UI_LIBRARY_URL}/:path*`,
},
{
source: '/new-docs',
destination: `${process.env.NEXT_PUBLIC_REFERENCE_DOCS_URL}`,
},
{
// redirect /docs/
// trailing slash caused by docusaurus issue with multizone
source: '/new-docs/',
destination: `${process.env.NEXT_PUBLIC_REFERENCE_DOCS_URL}`,
},
{
source: '/new-docs/:path*',
destination: `${process.env.NEXT_PUBLIC_REFERENCE_DOCS_URL}/:path*`,
},
// misc rewrites
{
source: '/humans.txt',
destination: `${process.env.NEXT_PUBLIC_DOCS_URL}/humans.txt`,
},
{
source: '/lawyers.txt',
destination: `${process.env.NEXT_PUBLIC_DOCS_URL}/lawyers.txt`,
},
{
source: '/.well-known/security.txt',
destination: `${process.env.NEXT_PUBLIC_DOCS_URL}/.well-known/security.txt`,
},
{
source: '/llms.txt',
destination: `${process.env.NEXT_PUBLIC_DOCS_URL}/llms.txt`,
},
{
source: '/llms/:path(.*\\.txt$)',
destination: `${process.env.NEXT_PUBLIC_DOCS_URL}/llms/:path`,
},
{ source: '/feed.xml', destination: `/rss.xml` },
]
module.exports = rewrites