Align Pages Router worker entry with prod-server request handling#171
Merged
southpolesteve merged 4 commits intomainfrom Feb 27, 2026
Merged
Align Pages Router worker entry with prod-server request handling#171southpolesteve merged 4 commits intomainfrom
southpolesteve merged 4 commits intomainfrom
Conversation
Fork PRs don't have access to repository secrets (CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID), so deploy/smoke-test/comment steps always fail. Add a fork detection condition to skip these steps gracefully. The build steps still run, so example builds are still validated for fork PRs.
The generated Cloudflare Worker entry for Pages Router apps was missing several request handling steps that the Node.js production server (prod-server.ts) already handled. This brings the two in sync: - Run middleware (runMiddleware) before routing - Apply next.config.js redirects, rewrites (before/after/fallback), and headers - Handle basePath stripping and trailing slash normalization - Merge middleware response headers with correct precedence - Guard renderPage with typeof check Also updates the two Pages Router examples (pages-router-cloudflare, realworld-api-rest) and exports vinext/config/config-matchers so the worker entry can import the shared matching utilities.
Incorporate upstream changes: backslash normalization for open redirect checks, allowedWidths for image optimization, and other main branch updates.
commit: |
|
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.
Summary
The generated Cloudflare Worker entry for Pages Router apps (
generatePagesRouterWorkerEntry()) was missing several request handling steps that the Node.js production server (prod-server.ts) already handled. This brings the two implementations in sync.runMiddlewareand applyvinextConfigrules (redirects, rewrites, headers) in the generated worker entryrenderPagewith atypeofcheck for robustnessvinext/config/config-matchersfrom the package so the worker entry can import the shared matching utilitiespages-router-cloudflare,realworld-api-rest) to matchTest plan
tsgo --noEmit)oxlint --deny-warnings)