Files
supabase/apps/www/lib/rewrites.js
T
Matt Rossman 8dc0f93c59 feat(www): serve evals frontend at /evals (#48321)
## Changes

Proxies `supabase.com/evals` to the
[evals](https://github.com/supabase/evals) frontend, following a similar
rewrite pattern as `/ui` and `/design-system`. The evals app already
serves under an `/evals` base path per supabase/evals#125.

The destination is hardcoded rather than an env var because the evals
app lives in a separate repo, and there’s not much benefit to a fully
local dev flow here, so the target URL is kept the same in every
environment.

## Before merge

- Disable deployment protection on the evals Vercel project, otherwise
`supabase.com/evals` will show a Vercel login page
- Wait until closer to Evals announcement target (July 30th)

Closes AI-826


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
  * Added routing for the `/evals` section and its subpages.
* Evals pages now load from the designated hosted destination while
preserving URL paths.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-29 17:44:49 -04:00

80 lines
2.0 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: '/design-system',
destination: `${process.env.NEXT_PUBLIC_DESIGN_SYSTEM_URL}`,
},
{
source: '/design-system/:path*',
destination: `${process.env.NEXT_PUBLIC_DESIGN_SYSTEM_URL}/:path*`,
},
{
source: '/evals',
destination: 'https://supabase-evals.vercel.app',
},
{
source: '/evals/:path*',
destination: 'https://supabase-evals.vercel.app/: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: '/feed.xml', destination: `/rss.xml` },
]
module.exports = rewrites