Skip to content

Commit 6ebac0b

Browse files
mrodgers-witekionashif
authored andcommitted
samples: http_server: document process to use HTTP/2 with web browser
Using HTTP/2 to communicate with the sample application using a web browser requires some additional steps. Add documentation describing this to the sample README file. Signed-off-by: Matt Rodgers <[email protected]>
1 parent f9b685d commit 6ebac0b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

samples/net/sockets/http_server/README.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,35 @@ HTTP/2 protocol from the host machine.
5555
- Using curl: ``curl --http2 -v --compressed http://192.0.2.1/``
5656
- Using h2load: ``h2load -n10 http://192.0.2.1/``
5757

58+
Web browsers use stricter security settings for the HTTP/2 protocol. So to use HTTP/2
59+
with a web browser, you must enable ``CONFIG_NET_SAMPLE_HTTPS_SERVICE`` and
60+
``CONFIG_NET_SAMPLE_HTTPS_USE_ALPN``. Additionally the server certificate must be signed
61+
by a CA certificate trusted by your browser.
62+
63+
The best way to do this is to generate your own CA certificate:
64+
65+
.. code-block:: bash
66+
67+
$ west build -b <board_to_use> -t sample_ca_cert samples/net/sockets/http_server
68+
69+
Generate a server certificate signed by this CA certificate:
70+
71+
.. code-block:: bash
72+
73+
$ west build -t sample_server_cert samples/net/sockets/http_server
74+
75+
And then build the application with the newly generated server certificate and key:
76+
77+
.. code-block:: bash
78+
79+
$ west build samples/net/sockets/http_server
80+
81+
The CA certificate should be added to your browser's list of trusted authorities to
82+
enable usage of HTTP/2. If using Firefox, it may also be required to change the setting
83+
``network.http.http2.enforce-tls-profile`` to false, since it seems that using a CA
84+
certificate issued by an authority unknown to Firefox is considered a security error when
85+
using HTTP/2.
86+
5887
Server Customization
5988
---------------------
6089

0 commit comments

Comments
 (0)