Vercel Configuration
Complete guide for setting up Nexting with Vercel.
Basic Setup
Vercel uses a vercel.json file to configure rewrites. This file should be placed in your project root.
{
"rewrites": [
{
"source": "/__verify__",
"destination": "https://api.nexting.ai/proxy/YOUR_PROJECT_KEY/__verify__"
},
{
"source": "/blog/:path*",
"destination": "https://api.nexting.ai/proxy/YOUR_PROJECT_KEY/blog/:path*"
}
]
}Wildcard Patterns
:path* to match any path under a directory. This way you don't need to add a new rule for each page.Merging with Existing Configuration
If you already have a vercel.json, add the Nexting rewrites to your existing rewrites array:
1{2 "framework": "nextjs",3 "buildCommand": "npm run build",4 "rewrites": [5 // Your existing rewrites6 {7 "source": "/api/:path*",8 "destination": "/api/:path*"9 },10 // Add Nexting rewrites below11 {12 "source": "/__verify__",13 "destination": "https://api.nexting.ai/proxy/YOUR_KEY/__verify__"14 },15 {16 "source": "/blog/:path*",17 "destination": "https://api.nexting.ai/proxy/YOUR_KEY/blog/:path*"18 }19 ]20}Rule Order Matters
Next.js Configuration
For Next.js projects, you can also configure rewrites in next.config.js:
/** @type {import('next').NextConfig} */
const nextConfig = {
async rewrites() {
return [
{
source: '/__verify__',
destination: 'https://api.nexting.ai/proxy/YOUR_KEY/__verify__',
},
{
source: '/blog/:path*',
destination: 'https://api.nexting.ai/proxy/YOUR_KEY/blog/:path*',
},
]
},
}
module.exports = nextConfigvercel.json and next.config.js rewrites, they are merged together.vercel.json takes precedence.Deployment
Add the configuration
Add or update your vercel.json file.
Commit and push
git add vercel.json
git commit -m "Add SEO pages proxy"
git push origin mainWait for deployment
Vercel will automatically deploy your changes. This typically takes 30-60 seconds.
Verify in Nexting
Go to your project settings in Nexting and click "Verify Configuration".
Using Environment Variables
For better security and flexibility, you can use environment variables in next.config.js:
const NEXTING_KEY = process.env.NEXTING_PROJECT_KEY
const nextConfig = {
async rewrites() {
return [
{
source: '/__verify__',
destination: `https://api.nexting.ai/proxy/${NEXTING_KEY}/__verify__`,
},
{
source: '/blog/:path*',
destination: `https://api.nexting.ai/proxy/${NEXTING_KEY}/blog/:path*`,
},
]
},
}
module.exports = nextConfigThen add NEXTING_PROJECT_KEY to your Vercel project's Environment Variables.
Common Issues
× 404 Not Found
The rewrite rules haven't taken effect yet.
× CORS Error
You're trying to access the proxy endpoint directly from JavaScript.
× Wrong page content
Another route in your app is matching before the rewrite rule.