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

Need backward compatibility to use http1 on Http2Server #18554

Closed
trivikr opened this issue Feb 4, 2018 · 6 comments
Closed

Need backward compatibility to use http1 on Http2Server #18554

trivikr opened this issue Feb 4, 2018 · 6 comments
Labels
feature request Issues that request new features to be added to Node.js. http Issues or PRs related to the http subsystem. http2 Issues or PRs related to the http2 subsystem.

Comments

@trivikr
Copy link
Member

trivikr commented Feb 4, 2018

  • Version: 9.5.0 (Current)
  • Platform: Any
  • Subsystem: http2

Details:

  • I was experimenting with http2 on fastify NodeJS Server by following this doc
  • Once http2 is out of experimental phase in Node v10, I'm planning to use its plain text version for communication between microservices.
  • For backward compatibility, I noticed that http2 allows http1 connection for Http2SecureServer
    if (options.allowHTTP1 === true)
    return httpConnectionListener.call(this, socket);
  • However, I couldn't find an option to pass allowHTTP1 in options for Http2Server
    class Http2Server extends NETServer {

Since microservices are updated independently of each other, we need a way to provide backward compatibility for http2 plain text server. Is there a plan to provide such option for Http2Server?

@trivikr
Copy link
Member Author

trivikr commented Feb 8, 2018

Any update on this request?

@devsnek
Copy link
Member

devsnek commented Feb 8, 2018

cc @nodejs/http2

@addaleax addaleax added http Issues or PRs related to the http subsystem. feature request Issues that request new features to be added to Node.js. http2 Issues or PRs related to the http2 subsystem. labels Feb 8, 2018
@jasnell
Copy link
Member

jasnell commented Feb 8, 2018

This is not yet possible with plain text http2 because the fallback mechanism depends entirely on the use of the ALPN tls extension.

Working on this is not currently in plan for me but I'm happy to review PRs if anyone wants to tackle it

@trivikr
Copy link
Member Author

trivikr commented Feb 8, 2018

I'd written some unit tests for NodeJS HTTP/2 in the past, and have an idea about how core.js works.
I can take this up. Any tips/suggestions on where to start wrt ALPN?

@mcollina
Copy link
Member

mcollina commented Feb 8, 2018

Any tips/suggestions on where to start wrt ALPN?

ALPN is already supported, it is the mechanism to support both HTTP/1.1 and HTTP/2 over the secure channel. Basically ALPN is used to kickstart the connection.

Upgrading from a plain text HTTP1 to HTTP2 would mean to use a similar flow to what is used for websockets (check out https://www.npmjs.com/package/ws) to upgrade the socket.
It might very well be possible that this flow could happen 80% in the ecosystem but we would need a little bit of support from Node core. This would be my preferred path.
I'm also ok in implement it fully within Node.js itself.

@jasnell
Copy link
Member

jasnell commented Aug 10, 2018

At this point in time, there's really no plan to implement this in core. The current implementation should not preclude anyone from providing an implementation that uses a similar http/1 upgrade path as is used by bootstrapping websockets.

@jasnell jasnell closed this as completed Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. http Issues or PRs related to the http subsystem. http2 Issues or PRs related to the http2 subsystem.
Projects
None yet
Development

No branches or pull requests

5 participants