Skip to content
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

Fix ALPN protocol identifier for HTTP/1.1 #142

Closed
wants to merge 1 commit into from

Conversation

pimterry
Copy link
Contributor

The ALPN identifier that https-proxy-agent uses for TLS is not correct. The IANA registry of valid values is here and you can see that for HTTP/1.1 it specifically has to be byte-identical to http/1.1 (note the slash) and http 1.1 as used here is not a valid identifier.

Because of this, ALPN negotiation always fails right now. Normally that's fine, because most TLS servers just fall back to plain HTTP anyway, but as of Node v19+, Node.js servers that use ALPN will reject all incoming connections that try to use ALPN but can't successfully agree on a protocol (according to the spec, everybody should be doing this really). Quite a lot of proxy servers do use ALPN, because it's effectively required to be able to use HTTP/2, so this may cause problems now that Node v20 is out (it breaks my tests, for one)

Anyway, it's fortunately a very quick and easy fix with no downside 😄

@TooTallNate
Copy link
Owner

Thanks @pimterry, I've applied a version of your change in 3b258fd.

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.

2 participants