-
-
Notifications
You must be signed in to change notification settings - Fork 957
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
H2C support #1751
Comments
Can you try with the |
Same error. |
You're running an insecure HTTP/2 server. Got doesn't support insecure HTTP/2 servers. |
Why it doesn't support it? I think the error could be more meaningful. There are some action items that can be done in this issue. |
It does not know if the protocol you're connecting to is Although it's possible to negotiate the protocol using HTTP/1.1, it's very complicated. Note that HTTP/3 does not support unencrypted traffic at all. |
It's possible to h2c if you know it's h2c in advance. See the example above. Since it's a quite popular issue, I'll reopen. This should be documented. |
Some libs like https://github.com/grantila/fetch-h2 support |
The underlying HTTP/2 client here is There is no origin set when using an insecure HTTP/2 connection. Therefore it's not possible to authenticate the server. The best is to provide your own session - that way you have 100% confidence that the server you're connecting to is the one you want. TL;DRIt would require many changes in One workaround is https://runkit.com/szmarczak/60c628126cf4590013d5e786 but I strongly discourage it. |
You can provide your own HTTP/2 session via the |
Out of curiosity: What the exact reason to implement an agent for HTTP2? Do you have any benchmarks? Node.js doesn't provide one.
I don't get it. I always specify the origin explicitly. The use case is for internal communication.
That's great but I don't see the benefit to do it always on my own. I'd expect that got can do it for me. Everything is provided by Node.js. |
Session management according to the HTTP/2 RFC. Node.js does not provide any interface for session management. How else would you connect to a HTTP/2 website?
I do. On my hardware If you really care about performance you might want to go with
But it doesn't work like that under the hood with HTTP/2. It's different than HTTP/1. The Got tells Manually providing the session is a much simpler approach. As I've mentioned before, the
Well, then one session should be enough. You can easily attach
I don't see the benefit here too:
What is the reason for using HTTP/2 and not HTTP/1? What is stopping you from using secure HTTP/2? Even browsers don't support unencrypted HTTP/2. |
First of all thank you for the write-up, very informative. I'm not very familiar with the internals of HTTP2.
I expected that using HTTP/2 for server-to-server communication is more efficient than HTTP/1 but I already benchmarked this on my own and found out that this is not the case (at least for Node.js). TLS would be already ensured by a sidecar like linkerd. |
Note aside: I tried making the |
No problem. I'm happy to answer all the questions :)
HTTP/2 is much much faster than HTTP/1, that's right. But networking generally in Node.js is kinda slow when compared to other languages.
Hmm... That's actually a remarkable point! Does |
As far I know yes. In that case, it just forwards it. |
Very sad because this is one of the selling points of Node.js |
As you can see the following https://runkit.com/szmarczak/60c660d153638b001aae99af is much simpler than the By using this the performance will be better because there's no stuff related to origin sets that is typical for secure HTTP/2 etc. |
In Got it's not possible to add custom protocols (we support only |
Thank you, I will check this out. |
Also if you're transferring big amounts of data, then keep in mind that currently it's hard to do so. See nodejs/node#38426 |
Yeah, I saw that workaround already in |
As titled. Already reported in fastify/fastify#3131
The text was updated successfully, but these errors were encountered: