Yes you use next.js API routes if you want to deploy a full stack next.js app to cloudflare
Yes you use next.js API routes if you want to deploy a full stack next.js app to cloudflare
@cloudflare/next-on-pages, it generates a worker that is deployed along with the static assets for your Pages project. That worker handles all incoming requests to your Next.js Pages projectnext server
wrangler.toml so that wrangler doesn’t pick it up
next dev you can use_redirects file, but that changed nothing (no redirect). I have tried to put the file in my root-directory and of course (and initially) to my public directory.https://nicokempe.eu/* https://www.nicokempe.eu/:splat 301!
@cloudflare/next-on-pagesnextwrangler.tomlnext dev_redirectshttps://nicokempe.eu/* https://www.nicokempe.eu/:splat 301!wrangler pages dev outdirconst redirects = async () => {
return [
{
source: '/:path*',
destination: 'https://www.nicokempe.eu/:path*',
permanent: true,
},
]
}
/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'],
images: {
unoptimized: true
},
redirects,
}