<p>I try to setup nginx ingress (nodeport) on google container with proxy protocol so that the real ip can be forwarded to backend service, but ended up with broken header.</p>

<pre><code>2017/02/05 13:48:52 [error] 18#18: *2 broken header: "�����~��]H�k��m[|����I��iv.�{y��Z �嵦v�Ȭq���2Iu4P�z;�    o$�s����"���+�/�,�0̨̩����/" while reading PROXY protocol, client: 10.50.0.1, server: 0.0.0.0:443
</code></pre>

<p>If without the proxy protocol, thing works well. According to the <a href="https://blog.mythic-beasts.com/2016/05/09/proxy-protocol-nginx-broken-header/" rel="noreferrer">https://blog.mythic-beasts.com/2016/05/09/proxy-protocol-nginx-broken-header/</a> this is due to the protocol v2 is used (binary), but nginx only can speak v1. Any suggestion?</p>

<p>GKE: With kubernetes v1.6+ source ip is preserved by default and can be found in headers under <code>x-real-ip</code> without setting any extra nginx config. </p>

<p>AWS: Source ip can be preserved by adding this to the annotations </p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: nginx-ingress
  namespace: nginx-ingress
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*'
  labels:
    app: nginx-ingress
</code></pre>

<p>Checkout this link 
<a href="https://github.com/kubernetes/ingress/tree/master/examples/aws/nginx" rel="nofollow noreferrer">https://github.com/kubernetes/ingress/tree/master/examples/aws/nginx</a></p>
