You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
vinext: middleware.ts does not run for files in public/ #743
In a vinext app deployed with Void, requests for files in public/ skip middleware.ts. Cloudflare serves these files from Workers Static Assets before the Worker runs. Next.js runs middleware for every path its matcher covers, including public/ files. Therefore, on Void, a middleware auth check on /report.pdf does not protect the file.
vinext fixed this in its own Cloudflare setup (cloudflare/vinext#3217). vinext init writes run_worker_first: ["/*", "!/_next/static/*", ...] (cloudflare/vinext#3804). Void can't use the same setting: since #660, static files skip the Worker, in order to not count toward the Workers Free limit of 100,000 requests a day.
Possible approach: if the app has middleware.ts, run the Worker first only for the paths its matcher covers. Apps without middleware keep the current routing.
Worker-first routing alone is not enough though. The build wrapper sends every GET or HEAD 404 from the framework to env.ASSETS (createAssetFallback), so a file is still served when middleware returns 404 for it.
Activity