mirror of
https://github.com/supabase/supabase.git
synced 2026-06-20 20:16:04 +08:00
* policy generation * add ai * refactor * table create performance * policy list * style * simplify * refactor * flag * tracking * track * ts * fixes * connection string * re-add rls and realtime toggle * restore old logic * base path * badge * false rls * copy * add permissions button * Refactor based on comments * Fix TS * More nudge * Update tests * Fix test * Fixx * Fix * Address feedback * Address issues * Improve experiment telemetry for generate policies A/B test (#41172) * Address code rabbit catch --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> Co-authored-by: Sean Oliver <882952+seanoliver@users.noreply.github.com>
40 lines
982 B
TypeScript
40 lines
982 B
TypeScript
import { IS_PLATFORM } from 'lib/constants'
|
|
import type { NextRequest } from 'next/server'
|
|
|
|
export const config = {
|
|
matcher: '/api/:function*',
|
|
}
|
|
|
|
// [Joshen] Return 404 for all next.js API endpoints EXCEPT the ones we use in hosted:
|
|
const HOSTED_SUPPORTED_API_URLS = [
|
|
'/ai/sql/generate-v4',
|
|
'/ai/sql/policy',
|
|
'/ai/feedback/rate',
|
|
'/ai/code/complete',
|
|
'/ai/sql/cron-v2',
|
|
'/ai/sql/title-v2',
|
|
'/ai/onboarding/design',
|
|
'/ai/feedback/classify',
|
|
'/ai/docs',
|
|
'/ai/table-quickstart/generate-schemas',
|
|
'/get-ip-address',
|
|
'/get-utc-time',
|
|
'/get-deployment-commit',
|
|
'/check-cname',
|
|
'/edge-functions/test',
|
|
'/edge-functions/body',
|
|
'/generate-attachment-url',
|
|
]
|
|
|
|
export function proxy(request: NextRequest) {
|
|
if (
|
|
IS_PLATFORM &&
|
|
!HOSTED_SUPPORTED_API_URLS.some((url) => request.nextUrl.pathname.endsWith(url))
|
|
) {
|
|
return Response.json(
|
|
{ success: false, message: 'Endpoint not supported on hosted' },
|
|
{ status: 404 }
|
|
)
|
|
}
|
|
}
|