1

I can't use Google's HTTP load balance because it does not support web socket.

So my NGINX is running in Google Container Engine, behind Google Network Load Balance.

When the request arrives NGINX in docker container, it gets the IP of the NODE instead of the client ip.

2016/04/07 10:53:47 [error] 94#0: *73 access forbidden by rule, client: 10.132.0.9

How to solve this problem?

2 Answers2

2

Getting the client IP when using Network Load balancer with Kubernetes is a known limitation. You can refer to this issue bug for updates and workarounds.

Faizan
  • 1,438
  • 10
  • 18
0

You get the IP of the "gce network load balancer" in the nginx logs?

since your question is not really clear, i presume your problem is in the nginx configuration. try adding x-forwarded-for option in nginx.conf more clear: real_ip_header X-Forwarded-For;

check the official google post https://cloud.google.com/solutions/https-load-balancing-nginx

nelasx
  • 161
  • 1
  • 9
  • Google Http Load Balancer does not support web socket. It is the NGINX running in POD can not get the real ip, has nothing to do with the `X-Forwarded-For` header – Mr.Wang from Next Door Apr 26 '16 at 13:04