Is anyone running the new Next.JS 12 middleware functions on Cloudflare's edge using workers?

Viewed 436

Cloudflare's workers are an edge based Javascript execution environment. They seem to me to be the perfect place for executing Next.JS 12's middleware concept.

It surprises me therefore that I can't find much evidence of people doing this despite extensive searching. I'm particularly interested in the idea of using Cloudflare just to execute the middleware and potentially to hold the static elements of a Next.JS build, but then to fall back to a separate (full Node) hosting environment where a getServerSideProps or similar needs to be executed.

One of the drawbacks of Next's middleware is that to really take advantage of it, you need to be on Vercel's platform and whilst I've nothing against that platform, I'd like to at least feel like my app is portable.

0 Answers
Related