From a8a6b2624d2332f3dbb89c7a5c197dacddcd31eb Mon Sep 17 00:00:00 2001 From: Gil Tayar Date: Mon, 7 Aug 2017 19:46:07 +0300 Subject: [PATCH 1/2] doc: added explanation about browser support of http/2 without SSL Since browser support HTTP/2 only using SSL, the basic example given in the docs won't work if the client is a browser. Added a note to documentation explaining this and how to change the code to make browser support it. --- doc/api/http2.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/api/http2.md b/doc/api/http2.md index 148c9f2ec36b33..195f908b384d95 100755 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -39,6 +39,12 @@ server.on('stream', (stream, headers) => { server.listen(80); ``` +Note that this is an HTTP server and does not support HTTPS. +This is significant as most browsers support HTTP/2 only on HTTPS. +To make the above server available for browsers, replace `http2.createServer()` +with +`http2.createSecureServer({key: /* your SSL key */, cert: /* your SSL cert */})`. + The following illustrates an HTTP/2 client: ```js From d336bbe50c5e2bc8018c3c57cd2057473380562b Mon Sep 17 00:00:00 2001 From: Gil Tayar Date: Tue, 8 Aug 2017 07:49:49 +0300 Subject: [PATCH 2/2] Fixed confusing nomenclature surrounding SSL --- doc/api/http2.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index 195f908b384d95..c1264c403d6729 100755 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -39,10 +39,10 @@ server.on('stream', (stream, headers) => { server.listen(80); ``` -Note that this is an HTTP server and does not support HTTPS. -This is significant as most browsers support HTTP/2 only on HTTPS. -To make the above server available for browsers, replace `http2.createServer()` -with +Note that the above example is an HTTP/2 server that does not support SSL. +This is significant as most browsers support HTTP/2 only with SSL. +To make the above server be able to serve content to browsers, +replace `http2.createServer()` with `http2.createSecureServer({key: /* your SSL key */, cert: /* your SSL cert */})`. The following illustrates an HTTP/2 client: