mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #602] [MERGED] fix: serve public directory files after middleware in production #703
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#703
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/602
Author: @southpolesteve
Created: 3/20/2026
Status: ✅ Merged
Merged: 3/20/2026
Merged by: @james-elicx
Base:
main← Head:fix/serve-static-after-middleware📝 Commits (2)
83e1aa6fix: serve public directory files after middleware in production1ad9652apply config headers before serving public directory static files📊 Changes
1 file changed (+32 additions, -9 deletions)
View changed files
📝
packages/vinext/src/server/prod-server.ts(+32 -9)📄 Description
Summary
/assets/*) are still served before middleware (step 1), since they are always publicDetails
Previously, all static files from
dist/client/were served in step 1, before middleware had a chance to run. This meant middleware could not protect or redirect requests to files from thepublic/directory.Next.js serves
_next/static/*(build output) directly but runs middleware before servingpublic/directory files. This change brings vinext in line with that behavior by only pre-serving Vite's hashed build output (/assets/*) and deferring everything else until after middleware.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.