1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-20 02:59:54 +02:00
Vishal Rana 2507dc13e9 website and recipe in the main repo
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-01 20:49:22 -07:00

1.3 KiB

title menu
HTTP2
side
identifier parent weight
http2 recipes 3

What is HTTP2?

HTTP/2 (originally named HTTP/2.0) is the second major version of the HTTP network protocol used by the World Wide Web

Features

  • Binary, instead of textual.
  • Fully multiplexed, instead of ordered and blocking, can therefore use just one TCP connection.
  • Uses header compression to reduce overhead.
  • Allows servers to "push" responses proactively into client caches.

How to run an HTTP/2 and HTTPS server?

Standard engine only

Generate a self-signed X.509 TLS certificate (HTTP/2 requires TLS to operate)

go run $GOROOT/src/crypto/tls/generate_cert.go --host localhost

This will generate cert.pem and key.pem files.

For demo purpose, we are using a self-signed certificate. Ideally you should obtain a certificate from CA.

Configure a server with engine.Config

server.go

{{< embed "http2/server.go" >}}

Endpoints

Maintainers

[Source Code]({{< source "http2" >}})