Skip to content

HTTP2 support with latest Go #32

@strarsis

Description

@strarsis

So there is a Golang nightly image on Dockerhub and I tried it out and built fabio with it.

And indeed - HTTP2 support seems to work out of the box - except one issue with the routing (see end).

Here are the steps to build fabio with latest Go for HTTP2 support + testing it out.
(You need four terminals, e.g. tmux tabs for comfortably doing this, you can also see all the logs then):

1st step / 1st terminal:

# Run consul standalone container:
docker run -p 8500:8500  gliderlabs/consul-server:0.5 -data-dir /tmp/consul -bootstrap-expect 1 -server

2nd step / 2nd terminal:

# Create test folder
cd ~/src \
&& mkdir fabio-build && cd fabio-build

# Build fabio using latest Go (for HTTP2 support built in):
docker run --rm -v $(pwd):/root/src strarsis/golang-nightly:build-1.5.2-nightly-57c81ef2570ac896fa5d830effbf2494d5cde3e5 /bin/sh -c \
'cd /root/src && export GOPATH=$(pwd) && go get -u github.com/eBay/fabio'

# Generate dummy certificates for fabio HTTPS
# *Most if not all HTTP2 clients require working TLS/SSL.
mkdir tls && cd tls \
&& openssl genrsa -des3 -out self-ssl.key -passout pass:test 2048 \
&& openssl req -new -key self-ssl.key -out self-ssl.csr -subj "/C=/ST=/L=/O=/CN=test.com" -passin pass:test \
&& cp -v self-ssl.{key,original} \
&& openssl rsa -in self-ssl.original -out self-ssl.key -passin pass:test \
&& rm -v self-ssl.original \
&& openssl x509 -req -days 365 -in self-ssl.csr -signkey self-ssl.key -out self-ssl.crt

# Configure + start fabio
cd .. \
&& echo 'proxy.addr = :9999,:9993;./tls/self-ssl.crt;./tls/self-ssl.key' > ./fabio.properties \
&& ./bin/fabio -cfg fabio.properties

3rd step / 3rd terminal:

# Build demo server
cd ~/src/fabio-build \
&& docker run --rm -v $(pwd):/root/src strarsis/golang-nightly:build-1.6beta1-nightly-e2093cdeef8dcf0303ce3d8e79247c71ed53507d /bin/sh -c \
'cd /root/src && export GOPATH=$(pwd) && go build src/github.com/eBay/fabio/demo/server/server.go'

# Run demo server
./server -addr 172.17.0.1:5000 -prefix test.com/test

4th step / 4th terminal:

# Install + run nghttp (HTTP2 client)
sudo apt-get install -y nghttp2
nghttp --header='Host:test.com' https://127.0.0.1:9993/test

Note that 9993 is used as port for HTTPS so fabio can run as non-root,
it will still work the same as with port 443.

There is no error message from nghttp, so the HTTP2 request is indeed working,
just no response (or 404?) - fabio (in 2nd terminal) logs the following:

No route for 127.0.0.1:9993/test

Health check for the demo server is OK and fabio route is set,
probably some special case to take into account when processing HTTP2 requests?

Go 1.6 Milestone: https://github.com/golang/go/milestones/Go1.6
Or will HTTP2 be already included in some nearer Go 1.5.x release?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions