samples: http_server: add option to use ALPN for HTTP2 support

Add application level Kconfig option to enable ALPN usage for
negotiating HTTP/2 connection with web browsers.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
This commit is contained in:
Matt Rodgers 2024-11-27 13:19:35 +00:00 committed by Anas Nashif
commit f9b685d3fe

View file

@ -18,11 +18,28 @@ config NET_SAMPLE_HTTPS_SERVICE
bool "Enable https service"
depends on NET_SOCKETS_SOCKOPT_TLS || TLS_CREDENTIALS
if NET_SAMPLE_HTTPS_SERVICE
config NET_SAMPLE_HTTPS_SERVER_SERVICE_PORT
int "Port number for https service"
default 443
depends on NET_SAMPLE_HTTPS_SERVICE
config NET_SAMPLE_HTTPS_USE_ALPN
bool "Allow HTTP2 connectivity with web browsers by using ALPN"
select MBEDTLS_SSL_ALPN
select HTTP_SERVER_TLS_USE_ALPN
help
Web browsers only use HTTP/2 over HTTPS, and use ALPN to determine if a
server supports HTTP/2. If this option is enabled, web browsers can use
HTTP/2 to communicate with the server. However web browsers are stricter
with security when using HTTP/2, at a minimum you will need to add the CA
certificate used to sign the server certificate into your web browser's
trusted authorities. Otherwise the connection can fail with a security
error, without giving an option to ignore this and proceed anyway.
endif # NET_SAMPLE_HTTPS_SERVICE
config NET_SAMPLE_PSK_HEADER_FILE
string "Header file containing PSK"
default "dummy_psk.h"