🔧 Routing Fix: - Remove redundant API rewrite rule that was causing conflicts - Use negative lookahead regex to exclude API routes from frontend rewrites - Only rewrite non-API, non-static routes to index.html - This should resolve API endpoints returning HTML instead of JSON 🚀 Expected Result: - /api/* routes will now properly reach Vercel functions - Frontend routes will still work correctly - Static assets remain unaffected
55 lines
1.1 KiB
JSON
55 lines
1.1 KiB
JSON
{
|
|
"rewrites": [
|
|
{
|
|
"source": "/((?!api|static|_next).*)",
|
|
"destination": "/index.html"
|
|
}
|
|
],
|
|
"headers": [
|
|
{
|
|
"source": "/static/(.*)",
|
|
"headers": [
|
|
{
|
|
"key": "Cache-Control",
|
|
"value": "public, max-age=31536000, immutable"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"source": "/api/(.*)",
|
|
"headers": [
|
|
{
|
|
"key": "Access-Control-Allow-Origin",
|
|
"value": "*"
|
|
},
|
|
{
|
|
"key": "Access-Control-Allow-Methods",
|
|
"value": "GET, POST, PUT, DELETE, OPTIONS"
|
|
},
|
|
{
|
|
"key": "Access-Control-Allow-Headers",
|
|
"value": "Content-Type, Authorization"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"source": "/(.*)",
|
|
"headers": [
|
|
{
|
|
"key": "X-Frame-Options",
|
|
"value": "DENY"
|
|
},
|
|
{
|
|
"key": "X-Content-Type-Options",
|
|
"value": "nosniff"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"functions": {
|
|
"api/**/*.ts": {
|
|
"runtime": "@vercel/node@3.2.0"
|
|
}
|
|
},
|
|
"buildCommand": "npm run build"
|
|
}
|