Repository navigation
fix(vinext): run middleware and next.config rules in Pages Router apps - #742
Draft
magurotuna wants to merge 1 commit into
Draft
magurotuna wants to merge 1 commit into
magurotuna wants to merge 1 commit into
Conversation
Void's generated Pages Router worker entry called vinext's renderPage and handleApiRoute directly, which skipped middleware and next.config redirects, rewrites and headers. Auth checks in middleware were bypassed. Use vinext's own Pages Router entry (vinext/server/pages-router-entry), as the App Router path already does. Void's cron and queue wrapper is unchanged. Add middleware and next.config fixtures to playground/vinext-pages, with dev and Miniflare build tests (both plugin orders) for redirects, rewrites and headers.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On current main, vinext Pages Router apps skip
middleware.tsand theredirects(),rewrites()andheaders()rules innext.config. For instance, auth checks in middleware never run. This is because Void's generated entry calls vinext'srenderPage()andhandleApiRoute()directly, which skips vinext's request handling.With this PR, the generated entry uses
vinext/server/pages-router-entry, as the App Router path already uses vinext's own entry.middleware.ts404307next.config404307middleware.tsornext.configFiles in
public/are still served without running middleware. This is unchanged from Void's current behavior, but differs from Next.js.Tests:
playground/vinext-pagesgains amiddleware.tsand anext.config.mjs, each with a redirect, a rewrite and a header. They are checked invp devand in a built Worker.Not tested on live Cloudflare.
AI disclosure: I used Claude to write code and this PR. I reviewed them.