Skip to content

A demo to use Jetty as an HTTP/2 server that is able to speak cleartext. This is intended to leverage the usage of HTTP/2 and its benefits without the hassles of encryption and management of TLS certificates.

Notifications You must be signed in to change notification settings

janweinschenker/jetty-http2-cleartext-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot example for http/2 cleartext

This small Spring Boot application is showcasing how to setup an application to serve both HTTP/1.1 and unencrypted HTTP/2 cleartext, known as h2c over the same port.

$ mvn clean package spring-boot:run

Then, install an http/2 test tool, like nghttp for example.

Use it like this:

$ nghttp -vua http://localhost:8080/hello-world

As you can see, nghttp performs a protocol upgrade from http/1.1 to h2c (http/2 cleartex), the unencrypted variant of http/2.

[  0.002] Connected
[  0.002] HTTP Upgrade request
GET /hello-world?name=Jan HTTP/1.1
host: localhost:8080
connection: Upgrade, HTTP2-Settings
upgrade: h2c
http2-settings: AAMAAABkAAQAAP__
accept: */*
user-agent: nghttp2/1.17.0

[  0.003] HTTP Upgrade response
HTTP/1.1 101 Switching Protocols

[  0.003] HTTP Upgrade success
[  0.005] recv HEADERS frame <length=67, flags=0x04, stream_id=1>
          ; END_HEADERS
          (padlen=0)
          ; First response header
{"id":19,"content":"Hello, Jan!"}[  0.005] recv DATA frame <length=33, flags=0x00, stream_id=1>

About

A demo to use Jetty as an HTTP/2 server that is able to speak cleartext. This is intended to leverage the usage of HTTP/2 and its benefits without the hassles of encryption and management of TLS certificates.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages