title: SPDY with HAProxy and Nginx
body: <p>I am using HAProxy as a loadbalancer and to terminate SSL. Behind that I've placed an Nginx. I'd like to use spdy/3.1.</p>
  
  <p>It does not work with the following <strong>haproxy.conf</strong> and <strong>nginx.cfg</strong>.  (files are serverd but according to <a href="https://chrome.google.com/webstore/detail/http2-and-spdy-indicator/mpbpobfflnpcgagjijhmgnchggcjblin" rel="nofollow" title="Chrome SPDY Indicator Plugin">Chrome SPDY/HTTP2 Indicator Plugin</a> it is just normal HTTP/1.1 traffic).</p>
  
  <p>I tried to strip unnecessary parts.</p>
  
  <p>What am I doing wrong? Do you have tips for debugging?</p>
  
  <p>(HAProxy 1.6 current and NginX 1.10 stable line)</p>
  
  <p>haproxy.cfg:</p>
  
  <pre><code>global
    daemon
    tune.ssl.default-dh-param 2048
  
  defaults
    mode tcp
  
  frontend myfrontend
    bind *:80
    bind *:443 ssl crt /etc/ssl/certificate.pem npn spdy/3.1,http/1.1 ciphers ECDH+AESGCM:HIGH:!aNULL:!MD5:!DSS:!RC4; no-sslv3
    acl istoplevel path /
    redirect scheme https if istoplevel !{ ssl_fc }
    redirect location / if !istoplevel !{ ssl_fc }
    rspadd Strict-Transport-Security:\ max-age=31536000;
    default_backend mybackend
  
  backend mybackend
    server s1 localhost:81
    option forwardfor
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }
  </code></pre>
  
  <p>nginx.conf:</p>
  
  <pre><code>user  nginx;
  
  http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
  
    sendfile        on;
    #tcp_nopush     on;
  
    server {
      listen 81 spdy;
      root /usr/share/nginx/html;
      index index.html;
  
      location / {
        try_files $uri $uri/ /index.html;
      }
    }
  }
  </code></pre>