Hi,
I'm using Nginx 1.1.19 installed in my hosts which are behind the ELB (elastic load balancer) in Amazon's cloud. I'm trying to use the "limit_req_zone" command to throttle the requests. What should this command evaluate to have access to the real remote IP?
This is the default way to use the command:
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
But "$binary_remote_addr" will bring the ELB's IP, not the client's IP.
I'm trying this now:
limit_req_zone $http_x_forwarded_for zone=...............
and it seems that it is working, but I'm not sure this will always work. I haven't seen anybody suggesting this approach, and haven't read it in any documentation so as to trust it will really work.
Or should I use the directives "set_real_ip_from" and "real_ip_header"? I read that is the way to do it, but it seems that those directives require the "ngx_http_limit_req_module" module, which seems that doesn't come with the normal installation of Nginx, and I don''t have any idea of how to install it with extra modules thet didn't come originally.
What is the right way to do this? I guess I'm not the first one to use Nginx behaind ELB, so I bet there must be an "official" way to do this.
By the way: I'm using Ubuntu 12.04.1, which brings Nginx 1.1.19.
Thanks in advance!