Skip to content

fix: allow Vercel preview deployments through CORS#103

Merged
solofberlin merged 3 commits into
mainfrom
fix/cors-vercel-previews
May 4, 2026
Merged

fix: allow Vercel preview deployments through CORS#103
solofberlin merged 3 commits into
mainfrom
fix/cors-vercel-previews

Conversation

@solofberlin
Copy link
Copy Markdown
Contributor

Summary

  • Adds regex-based origin matching (/^https:\/\/.*\.vercel\.app$/) alongside the existing static allowlist in src/main.ts
  • Fixes CORS errors on Vercel preview deployments like reservemento-<uuid>.MentoLabs.vercel.app
  • No change to existing static origins — they continue to work as before

Context

The CORS config has always used exact string matching against a hardcoded list. Vercel preview URLs are dynamically generated per deploy, so they never matched. There was never a wildcard/regex pattern — this adds the first one.

Sentry issue: https://mento-labs.sentry.io/issues/6762463110/

Test plan

  • Deploy to preview and verify a Vercel preview frontend can call the API without CORS errors
  • Verify production origins (mento.org, reserve.mento.org, etc.) still work
  • Verify requests with no origin (SSR, Postman) still work

🤖 Generated with Claude Code

solofberlin and others added 3 commits May 4, 2026 09:55
Add regex-based origin matching for *.vercel.app alongside the existing
static allowlist, so Vercel preview URLs like
reservemento-<uuid>.MentoLabs.vercel.app are no longer blocked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add regex-based origin matching for *-mentolabs.vercel.app alongside
the existing static allowlist, so Vercel preview URLs like
reservemento-<uuid>-mentolabs.vercel.app are no longer blocked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@solofberlin solofberlin merged commit 438ba78 into main May 4, 2026
2 of 3 checks passed
@solofberlin solofberlin deleted the fix/cors-vercel-previews branch May 4, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant