MCPcopy Index your code
hub / github.com/simstudioai/sim / resolveApiCorsPolicy

Function resolveApiCorsPolicy

apps/sim/proxy.ts:87–98  ·  view source on GitHub ↗
(request: NextRequest)

Source from the content-addressed store, hash-verified

85
86/** Single source of truth for /api/* CORS — resolved at request time, not baked at build. */
87export function resolveApiCorsPolicy(request: NextRequest): CorsPolicy {
88 const { pathname } = request.nextUrl
89 for (const rule of CORS_RULES) {
90 if (rule.match(pathname)) return rule.policy(request)
91 }
92 return {
93 origin: getEnv('NEXT_PUBLIC_APP_URL') || 'http://localhost:3001',
94 credentials: true,
95 methods: 'GET,POST,OPTIONS,PUT,DELETE',
96 headers: DEFAULT_API_ALLOWED_HEADERS,
97 }
98}
99
100const CORS_PREFLIGHT_MAX_AGE = '86400'
101

Callers 2

proxy.test.tsFile · 0.90
proxyFunction · 0.85

Calls 1

getEnvFunction · 0.90

Tested by

no test coverage detected