Skip to content

fix(dev): conditionally set status message for HTTP/2 compatibility #13460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

jacob-briscoe
Copy link

closes #13459

Copy link

changeset-bot bot commented Apr 24, 2025

⚠️ No Changeset found

Latest commit: 48a0122

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Apr 24, 2025

Hi @jacob-briscoe,

Welcome, and thank you for contributing to React Router!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected].

Thanks!

- The Remix team

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Apr 24, 2025

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@MichaelDeBoey MichaelDeBoey changed the title fix: conditionally set status message for HTTP/2 compatibility fix(dev): conditionally set status message for HTTP/2 compatibility Apr 24, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request conditionally sets the HTTP status message for responses based on the HTTP version to ensure HTTP/2 compatibility and updates the contributors list.

  • Conditionally sets statusMessage in the node adapter based on HTTP version
  • Adds a new contributor in contributors.yml

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/react-router-dev/vite/node-adapter.ts Introduces a conditional check to set the status message only for HTTP versions that support it.
contributors.yml Adds a new contributor entry to the list.
Comments suppressed due to low confidence (1)

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

  • When nodeRes.req is undefined, the code assumes an HTTP/1.x environment; ensure that this assumption holds true in all deployment scenarios to avoid setting a statusMessage on protocols where it may not be supported.
if (!nodeRes.req || nodeRes.req.httpVersionMajor < 2) {

@brophdawg11
Copy link
Contributor

Do we need to make this same change in sendRemixResponse in packages/react-router-express/server.ts?

@jacob-briscoe
Copy link
Author

Do we need to make this same change in sendRemixResponse in packages/react-router-express/server.ts?

Good question, I'll take a look. Thank you!

adds link to RFC info on http/2 status messages

Co-authored-by: Matt Brophy <[email protected]>
@jacob-briscoe
Copy link
Author

Do we need to make this same change in sendRemixResponse in packages/react-router-express/server.ts?

I looked into this a little more and noticed that express doesn't support http/2 yet. So, for this PR no we don't necessarily have to implement this because when using express with ssl we don't receive the warning about the header being sent.

I did attempt to get express to use http/2 but didn't have much luck with it. There are a couple of solutions out there, one of which is spdy but it doesn't seem to be active nor does it support newer versions of node. I also attempted node's built-in http2 module but there seems to be a compat issue with express because I keep getting server crashes -- unrelated to this particular header issue.

I don't mind introducing the logic here to handle this for the future, but it isn't currently an issue.

RE express http/2 initiative: expressjs/express#5462
RE spdy: https://github.com/spdy-http2/node-spdy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UnsupportedWarning: Status message is not supported by HTTP/2 (RFC7540 8.1.2.4)
3 participants