X
X
xaduha2015-05-02 19:57:20
Nginx
xaduha, 2015-05-02 19:57:20

How to configure Haproxy with SPDY or HTTP/2 support in TCP ALPN mode?

Most SPDY and HTTP/2 servers won't let you hang unsecured SPDY or HTTP/2 on a separate port, but Nginx does. Here are working configs for this:
haproxy.conf

defaults
  mode tcp
  timeout client 10s
  timeout connect 10s
  timeout server 10s

frontend spdyRaw
  bind 0.0.0.0:443 ssl crt cert.pem alpn spdy/3.1
  default_backend nginxSpdyRaw

backend nginxSpdyRaw
  server backend1 0.0.0.0:82

frontend spdySsl
  bind 0.0.0.0:444 ssl crt cert.pem alpn spdy/3.1
  default_backend nginxSpdySsl

backend nginxSpdySsl
  server backend2 0.0.0.0:83

nginx.conf
events {
  worker_connections 2048;
}
http {
  server {
    ssl_certificate      /server.crt;
    ssl_certificate_key  /server.key;
    listen 0.0.0.0:82 spdy;
    listen 0.0.0.0:83 ssl spdy;
    location / {
      return 200 "Hello Spdy!";
    }
  }
}

https://localhost:443 works
https://localhost:82 doesn't work
https://localhost:444 works
https://localhost:83 doesn't work
What I'm trying to get: generic Haproxy ALPN config for SPDY and HTTP/2 servers .

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question