Skip to content

fix(pages): diagnose misplaced middleware - #1055

Draft
hyfdev wants to merge 5 commits into
mainfrom
fix/pages-middleware-diagnostic
Draft

hyfdev wants to merge 5 commits into
mainfrom
fix/pages-middleware-diagnostic

Conversation

@hyfdev

@hyfdev hyfdev commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Void Pages ignores a _middleware.ts placed under pages/, so a guard written there never runs and the pages it was meant to protect stay reachable.

#808 asks for routes/admin/_middleware.ts, and the same file under pages/ would silently do nothing.

Builds now fail on any _middleware.* file in the Pages tree:

pages: Directory middleware is unsupported in Void Pages ("pages/admin/_middleware.ts"). Use global middleware in middleware/ or a shared guard in page loaders and actions.

In dev, the terminal shows this message and requests that reach the server return it as a 500 until the file is removed, and the running server then recovers.

A pages/ directory owned by another framework is not checked, and void prepare output is unchanged.

The server routing guide now shows how to protect a Pages section with global middleware or a shared check in loaders and actions.

Part of #808.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

Cloudflare builds and deploys previews for this pull request. Learn more about Cloudflare previews.

Worker Status Deployment Commit
void-cloud Deployed Preview e7dceae

Updated: Dec 6, 2026, 03:25 UTC | Dashboard

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant