The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Make check-cname endpoint GET, and improve middleware checking (#37235)
Joshen Lim65c6a683cd60
diff --git a/apps/studio/data/custom-domains/check-cname-mutation.ts b/apps/studio/data/custom-domains/check-cname-mutation.tsindex dd8c2003e05..183a53514d5 100644--- a/apps/studio/data/custom-domains/check-cname-mutation.ts+++ b/apps/studio/data/custom-domains/check-cname-mutation.ts@@ -1,5 +1,5 @@import { useMutation, UseMutationOptions } from '@tanstack/react-query'-import { constructHeaders, fetchHandler, handleError } from 'data/fetchers'+import { fetchHandler, handleError } from 'data/fetchers'import { BASE_PATH } from 'lib/constants'import { toast } from 'sonner'@@ -24,12 +24,9 @@ export type CheckCNAMERecordResponse = {// [Joshen] Should tally with https://github.com/supabase/cli/blob/63790a1bd43bee06f82c4f510e709925526a4daa/internal/utils/api.go#L98export async function checkCNAMERecord({ domain }: CheckCNAMERecordVariables) {try {- const headers = await constructHeaders({ 'Content-Type': 'application/json' })- const res: CheckCNAMERecordResponse = await fetchHandler(`${BASE_PATH}/api/check-cname`, {- headers,- method: 'POST',- body: JSON.stringify({ domain }),- }).then((res) => res.json())+ const res: CheckCNAMERecordResponse = await fetchHandler(+ `${BASE_PATH}/api/check-cname?domain=${domain}`+ ).then((res) => res.json())if (res.Answer === undefined) {throw new Error(diff --git a/apps/studio/middleware.ts b/apps/studio/middleware.tsindex 122e48a481d..34d405e60ed 100644--- a/apps/studio/middleware.ts+++ b/apps/studio/middleware.ts@@ -30,7 +30,10 @@ const HOSTED_SUPPORTED_API_URLS = []export function middleware(request: NextRequest) {- if (IS_PLATFORM && !HOSTED_SUPPORTED_API_URLS.some((url) => request.url.endsWith(url))) {+ 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 }diff --git a/apps/studio/pages/api/check-cname.ts b/apps/studio/pages/api/check-cname.tsindex 276491bcd2a..aad6be583b9 100644--- a/apps/studio/pages/api/check-cname.ts+++ b/apps/studio/pages/api/check-cname.ts@@ -2,7 +2,7 @@ import { CheckCNAMERecordResponse } from 'data/custom-domains/check-cname-mutatiimport { NextApiRequest, NextApiResponse } from 'next'const handler = async (req: NextApiRequest, res: NextApiResponse) => {- const { domain } = req.body+ const { domain } = req.querytry {const result: CheckCNAMERecordResponse = await fetch(