title: Nginx: broken_header with proxy_protocol and ELB
body: <p>I am trying to set up proxy_protocol in my nginx config. My server sits behind an AWS load balancer (ELB), and I have enabled Proxy Protocol on that for both ports 80 and 443. </p>
  
  <p>However, this is what I get when I hit my server:</p>
  
  <pre><code>broken header: "��/��
                                                               '���\DW�Vc�A{����
                                                                                �@��kj98���=5���g@32ED�&lt;/A
      " while reading PROXY protocol, client: 172.31.12.223, server: 0.0.0.0:443
  </code></pre>
  
  <p>That is a direct copy paste from the nginx error log - wonky characters and all. </p>
  
  <p>Here is a snip from my nginx config: </p>
  
  <pre><code>server {
    listen  80 proxy_protocol;
    set_real_ip_from 172.31.0.0/20; # Coming from ELB
    real_ip_header proxy_protocol;
    return  301 https://$http_host$request_uri;
  }
  
  server {
    listen      443 ssl proxy_protocol;
    server_name *.....com
    ssl_certificate      /etc/ssl/&lt;....&gt;;
    ssl_certificate_key  /etc/ssl/&lt;....?;
    ssl_prefer_server_ciphers On;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!DSS:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4;
    ssl_session_cache shared:SSL:10m;
    add_header X-Frame-Options DENY;
    add_header X-Content-Type-Options nosniff;
    ssl_stapling on;
    ssl_stapling_verify on;
  
  
    ...
  </code></pre>
  
  <p>I can't find any help online about this issue. Other people have had broken header issues, but the error with bad headers are always readable - they don't look like they are encoded like they are for me. </p>
  
  <p>Any ideas?</p>