Create professional demos and 3D mockups in seconds, directly in your browser
feat: integrate Supabase session management into proxy middleware
CristianOlivera15f153c9d0334
diff --git a/.env.example b/.env.exampleindex f190edf..31656b5 100644--- a/.env.example+++ b/.env.example@@ -1,6 +1,8 @@-# Optional - only needed for the in-editor photo picker (Unsplash/Pexels/Pixabay).-# All keys are read server-side, so they never reach the client bundle.-# Without these the app still runs; only the photo picker returns empty results.-UNSPLASH_ACCESS_KEY=-PEXELS_API_KEY=-PIXABAY_API_KEY=+UNSPLASH_ACCESS_KEY=x.y.z+UNSPLASH_SECRET_KEY=x.y.z+PEXELS_API_KEY=x.y.z+PIXABAY_API_KEY=x.y.z++# Supabase Configuration+NEXT_PUBLIC_SUPABASE_URL=x.y.z+NEXT_PUBLIC_SUPABASE_ANON_KEY=x.y.z\ No newline at end of filediff --git a/proxy.ts b/proxy.tsindex 0f7d508..23d6f83 100644--- a/proxy.ts+++ b/proxy.ts@@ -1,6 +1,7 @@import { type NextRequest } from "next/server";import createIntlMiddleware from 'next-intl/middleware';import { locales, defaultLocale } from './i18n';+import { updateSession } from "@/utils/supabase/middleware";const intlMiddleware = createIntlMiddleware({locales,@@ -15,6 +16,11 @@ export default async function proxy(request: NextRequest) {const intlResponse = intlMiddleware(request);intlResponse.headers.set('x-user-country', country);+ const supabaseResponse = await updateSession(request);+ supabaseResponse.cookies.getAll().forEach((cookie) => {+ intlResponse.cookies.set(cookie.name, cookie.value);+ });+return intlResponse;}