Files
supabase/apps/studio/proxy.ts
Saxon Fletcher d2f4e808e5 Filter pattern refactor (#41545)
* filter refactor

* update tests

* prettier

* fix ts

* remove filter preview

* Filter bar in table editor behind flag (#41546)

filter bar in table editor behind flag

* fixes

* ts fix

* filter v1 refactor

* rename helpers

* unmount timeout

* fixes

* fix

* more
2026-01-06 08:04:28 +10:00

43 lines
1.0 KiB
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/sql/filter-v1',
'/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',
'/incident-status',
'/api/integrations/stripe-sync',
]
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 }
)
}
}