From dcf87139bc796ecf70d5a65979ff109dbc903490 Mon Sep 17 00:00:00 2001 From: Mobile Byte Labs Date: Fri, 19 Jun 2026 11:44:16 +0530 Subject: [PATCH] perf(dashboard): pin Vercel serverless region to bom1 (Mumbai) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Production was running in iad1 (US East) while users are in India, making every protected page render a trans-continental round-trip: bom1 (edge) → iad1 (function) → Supabase → iad1 → bom1 ≈ 180ms × 2 + Supabase 250ms = ~600-1000ms per click Pinning to bom1 collocates the serverless function with the user and the Supabase project (also in Mumbai region), cutting the round-trip from ~400ms to ~50ms and eliminating the cross-region Supabase hop. Changes: - Add dashboard/vercel.json (the one Vercel actually reads — Root Directory = dashboard/). Mirrors infra/vercel.json's security headers + /app redirect, but overrides the region. - Also update infra/vercel.json's regions so the two stay consistent if anyone copies infra/vercel.json forward. Expected impact (re-measure after deploy): Before: /dashboard 650ms, /api/health 1050ms After: /dashboard ~250ms, /api/health ~400ms Co-Authored-By: Claude Opus 4.7 (1M context) --- dashboard/vercel.json | 31 +++++++++++++++++++++++++++++++ infra/vercel.json | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 dashboard/vercel.json diff --git a/dashboard/vercel.json b/dashboard/vercel.json new file mode 100644 index 0000000..9e13e47 --- /dev/null +++ b/dashboard/vercel.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://openapi.vercel.sh/vercel.json", + "regions": ["bom1"], + "headers": [ + { + "source": "/(.*)", + "headers": [ + { "key": "X-Frame-Options", "value": "DENY" }, + { "key": "X-Content-Type-Options", "value": "nosniff" }, + { "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" }, + { + "key": "Permissions-Policy", + "value": "camera=(), microphone=(), geolocation=()" + } + ] + }, + { + "source": "/api/(.*)", + "headers": [ + { "key": "Cache-Control", "value": "no-store, max-age=0" } + ] + } + ], + "redirects": [ + { + "source": "/app", + "destination": "/dashboard", + "permanent": false + } + ] +} diff --git a/infra/vercel.json b/infra/vercel.json index 77b0b93..4298930 100644 --- a/infra/vercel.json +++ b/infra/vercel.json @@ -3,7 +3,7 @@ "buildCommand": "pnpm --filter dashboard build", "outputDirectory": "dashboard/.next", "framework": "nextjs", - "regions": ["iad1"], + "regions": ["bom1"], "headers": [ { "source": "/(.*)",