hashicorp / hashicorp/nomad

Support H2C (http2 over plaintext) in nomad api server

Open
#19,212 1 comment 1 reaction 0 assignees View on GitHub
stage/needs-discussion theme/api type/enhancement
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

### Proposal
enable H2C support on Nomad api server , so when we access API behind a load balancer we can still use HTTP2.

```
h2s := &http2.Server{}

handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %v, http: %v", r.URL.Path, r.TLS == nil)
})

server := &http.Server{
Addr: "0.0.0.0:1010",
Handler: h2c.NewHandler(handler, h2s),
}

fmt.Printf("Listening [0.0.0.0:1010]...\n")
checkErr(server.ListenAndServe(), "while listening")
```

use following code example, and will make nomad API port support http1, http2, h2c upgrade, h2c pri knowledge all automatically ,regardless if TLS is enabled.

### Use-cases
If the access to Nomad API is proxied through a AWS LB, which does the TLS, we can't enable HTTP2 support, which makes the UI super unresponsive because browser only supports 6 connections at same time.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating Nomad's API server entry point and reviewing how its HTTP and TLS listeners are configured. Use the issue's h2c.NewHandler example as the reference, and verify that the API supports HTTP/1, HTTP/2, h2c upgrade, and h2c prior knowledge with and without TLS.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.