Skip to content

Commit b840885

Browse files
fix(dev): conditionally set status message for HTTP/2 compatibility (#13460)
1 parent 36686ed commit b840885

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

.changeset/sour-eggs-give.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@react-router/dev": patch
3+
---
4+
5+
Fix "Status message is not supported by HTTP/2" error during dev when using HTTPS

contributors.yml

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
- ivanjonas
146146
- Ivanrenes
147147
- JackPriceBurns
148+
- jacob-briscoe
148149
- jacob-ebey
149150
- JaffParker
150151
- jakkku

packages/react-router-dev/vite/node-adapter.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ export function fromNodeRequest(
8686
// https://github.com/solidjs/solid-start/blob/7398163869b489cce503c167e284891cf51a6613/packages/start/node/fetch.js#L162-L185
8787
export async function toNodeRequest(res: Response, nodeRes: ServerResponse) {
8888
nodeRes.statusCode = res.status;
89-
nodeRes.statusMessage = res.statusText;
89+
90+
// HTTP/2 doesn't support status messages
91+
// https://datatracker.ietf.org/doc/html/rfc7540#section-8.1.2.4
92+
if (!nodeRes.req || nodeRes.req.httpVersionMajor < 2) {
93+
nodeRes.statusMessage = res.statusText;
94+
}
9095

9196
let cookiesStrings = [];
9297

0 commit comments

Comments
 (0)