Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
giltayar committed Aug 7, 2017
commit a8a6b2624d2332f3dbb89c7a5c197dacddcd31eb
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 this is an HTTP server and does not support HTTPS.
Copy link
Copy Markdown
Contributor

@mscdex mscdex Aug 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/this/the above example/

Also, I think using the terms HTTP and HTTPS could be confusing since I would bet most people would associate those terms with HTTP 1.x?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 ... s/HTTP server/HTTP2 server

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or perhaps better yet: 'HTTP/2 server', which is used elsewhere in this document.

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
Expand Down