Skip to content

fix: apply configured headers to 404 responses#22554

Open
SSDWGG wants to merge 1 commit into
vitejs:mainfrom
SSDWGG:codex/server-headers-404
Open

fix: apply configured headers to 404 responses#22554
SSDWGG wants to merge 1 commit into
vitejs:mainfrom
SSDWGG:codex/server-headers-404

Conversation

@SSDWGG
Copy link
Copy Markdown

@SSDWGG SSDWGG commented May 30, 2026

Summary

  • apply configured server.headers / preview.headers to Vite 404 responses
  • keep the existing 404 middleware behavior while setting configured headers before ending the response
  • add a playground regression for POST requests that fall through to the dev-server 404 handler

Fixes #22543

Validation

  • pnpm exec oxfmt packages/vite/src/node/server/middlewares/notFound.ts packages/vite/src/node/server/index.ts packages/vite/src/node/preview.ts playground/fs-serve/__tests__/commonTests.ts
  • pnpm exec eslint --cache --concurrency auto packages/vite/src/node/server/middlewares/notFound.ts packages/vite/src/node/server/index.ts packages/vite/src/node/preview.ts playground/fs-serve/__tests__/commonTests.ts
  • pnpm --filter vite build
  • pnpm exec vitest run -c vitest.config.e2e.ts playground/fs-serve/__tests__/fs-serve.spec.ts

@SSDWGG
Copy link
Copy Markdown
Author

SSDWGG commented May 30, 2026

I checked the current failures. The Run zizmor job is failing before auditing this PR because it cannot list tags for actions-cool/issues-helper in .github/workflows/issue-close-require.yml (403 Forbidden from GitHub/git-upload-pack), so that looks unrelated to this branch. The Windows CI failure was a single playground HMR timeout (Timeout waiting for browser logs in playground/hmr/__tests__/hmr.spec.ts), also not tied to the changed 404-header code.

@SSDWGG SSDWGG marked this pull request as ready for review May 30, 2026 09:33
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.

server.headers configuration not applied consistently.

1 participant