Hello, this issue outlines the proposed changes that I would like to make to how next-on-pages handles routing. The Vercel build output config contains the different steps taken during the routing ...
@Better James do you know if it can rewrite to an external destination (another CF worker hosting an API server)? I am getting 503 cloudflare network errors and unable to see much from the logs. The Pages docs on proxying redirects says it can only proxy relative URLs. So that makes me think it isn't supported for the NextJS rewrites. https://developers.cloudflare.com/pages/platform/redirects/#proxying
To use redirects on Cloudflare Pages, declare your redirects in a plain text file called _redirects without a file extension, in the output folder of …
Thanks a lot for the reply. It kept me from going down the wrong rabbit hole. There was an issue with the environment variable used for my rewrite destination. I read a bunch of your PR, the technical explanation of next-on-pages routing and looked at the unminified output files. The nextjs config rewrites are put into the built routing config in the filesystem phase. The fetch handler for the worker calls generateResponse after matching the route. If the matching route is a url, it uses fetch to get a response from the remote url. Makes sense. https://github.com/cloudflare/next-on-pages/blob/main/packages/next-on-pages/templates/_worker.js/handleRequest.ts#L73