Skip to content

Commit

Permalink
doc: explain browser support of http/2 without SSL
Browse files Browse the repository at this point in the history
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.

PR-URL: #14670
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
  • Loading branch information
giltayar authored and addaleax committed Aug 14, 2017
1 parent dbb9c37 commit 1e7ddb2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ server.on('stream', (stream, headers) => {
server.listen(80);
```

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:

```js
Expand Down

0 comments on commit 1e7ddb2

Please sign in to comment.