Cloudflare Configuration
Configure Nexting with Cloudflare Workers or Pages.
Cloudflare Pages
Create a _redirects file in your output directory:
_redirects
/__verify__ https://api.nexting.ai/proxy/YOUR_KEY/__verify__ 200
/blog/* https://api.nexting.ai/proxy/YOUR_KEY/blog/:splat 200Cloudflare Workers
For more control, use a Worker to handle the proxy:
worker.js
const NEXTING_KEY = 'YOUR_KEY'
const PROXY_PATHS = ['/__verify__', '/blog/']
export default {
async fetch(request) {
const url = new URL(request.url)
// Check if path should be proxied
const shouldProxy = PROXY_PATHS.some(path =>
url.pathname === path || url.pathname.startsWith(path)
)
if (shouldProxy) {
const proxyUrl = `https://api.nexting.ai/proxy/${NEXTING_KEY}${url.pathname}`
return fetch(proxyUrl, {
headers: request.headers,
})
}
// Pass through to origin for other paths
return fetch(request)
}
}This Worker intercepts matching paths and proxies them to Nexting while passing all other requests to your origin server.