Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

add cf headers for cms draft mode (#38822)

Francesco Sansalvadore5c9605e09c56
diff --git a/apps/www/app/api-v2/cms-posts/route.ts b/apps/www/app/api-v2/cms-posts/route.ts
index 04f64cf7680..9df5606bde0 100644
--- a/apps/www/app/api-v2/cms-posts/route.ts
+++ b/apps/www/app/api-v2/cms-posts/route.ts
@@ -6,10 +6,11 @@ import { generateReadingTime } from '~/lib/helpers'
// Lightweight runtime for better performance
export const runtime = 'edge'
-// CORS headers for cross-origin requests
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
+ 'CF-Access-Client-Id': process.env.CF_ACCESS_CLIENT_ID ?? '',
+ 'CF-Access-Client-Secret': process.env.CF_ACCESS_CLIENT_SECRET ?? '',
}
// Lightweight TOC generation for edge runtime
diff --git a/turbo.json b/turbo.json
index 64a448b08ab..d7ed335d3bb 100644
--- a/turbo.json
+++ b/turbo.json
@@ -114,6 +114,8 @@
"dependsOn": ["^build"],
"env": [
"ANALYZE",
+ "CF_ACCESS_CLIENT_ID",
+ "CF_ACCESS_CLIENT_SECRET",
"CMS_API_KEY",
"CMS_PREVIEW_SECRET",
"CMS_SITE_ORIGIN",