Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP2 support with latest Go #32

Closed
strarsis opened this issue Dec 16, 2015 · 3 comments
Closed

HTTP2 support with latest Go #32

strarsis opened this issue Dec 16, 2015 · 3 comments
Milestone

Comments

@strarsis
Copy link

strarsis commented Dec 16, 2015

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?

@magiconair
Copy link
Contributor

HTTP/2 will not be included with Go 1.5 since Go 1.5 has no HTTP/2 support. I'll have a look

@strarsis
Copy link
Author

Go 1.6 Beta came out: https://github.com/golang/go/releases/tag/go1.6beta1
Docker image: strarsis/golang-nightly:build-1.6beta1-nightly-e2093cdeef8dcf0303ce3d8e79247c71ed53507d

@magiconair
Copy link
Contributor

Just tested this with go1.6rc2. I need to make one small modification to enable HTTP/2 support but then it seems to work out of the box.

magiconair added a commit that referenced this issue Feb 7, 2016
Drop the hard coded next protocols for the TLS config
which defeats the auto configuration for both
HTTP and HTTP2
@magiconair magiconair added this to the 1.0.9 milestone Feb 7, 2016
@magiconair magiconair modified the milestones: 1.0.9, 1.1 Feb 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants