Closed abnud11 closed 3 months ago
That's not the same issue at all, this is expected and working as expected. You're telling it yourself the middleware run behind the CDN, so you cannot use the middleware to protect cached route (i.e. ISR or SSG ). If you want to restrict access to some route they need to be SSR.
Anyway this issue does not belong in this repo. Since OpenNext v3 you can make the middleware external and deploy it in lambda@edge or in cloudflare in front of your CDN. This doesn't work in ion for now, but that's a limitation of ion, not OpenNext. There is an open PR in the ion repo to do that with cloudflare https://github.com/sst/ion/pull/588.
I'm going to close this as this is not an issue in OpenNext
I have multiple routes protected by authentication through a middleware
I'm deploying to AWS using sst ion, anyway I'm facing the same issue as this one: https://github.com/sst/open-next/issues/376
Only my OS is linux not windows so this is not a windows issue.
I know that in Open Next middleware doesn't run in front of a CDN which is different from vercel but how to make authentication work if cached responses don't first check if user is authenticated to see cached response before serving from cache?
Environment Info: OS: Arch Linux x64(but deploying server function using arm64 architecture) sst ion version: 0.1.28 Open Next version: 3.0.8 Next.js version: 14.2.5 Node.js version: 20.x runtime