Unable to use custom variable with limit_conn_zone

paulswansea nginx-forum at nginx.us
Sat Sep 27 18:24:00 UTC 2014

I am trying to use the limit connections / limit request.  I have the server
behind a proxy, the proxy has the following line :

    proxy_set_header        X-Real-IP       $remote_addr;

and in my nginx.conf on my server behind the proxy i have :

    limit_conn_zone $http_x_real_ip zone=perip:10m;
    limit_conn perip 20;
    limit_req_zone $http_x_real_ip zone=forward:10m rate=60r/m;

However, when checking my logs, I get the internal address of the proxy
server listed, not the external real ip :

    2014/09/27 13:45:16 [error] 57287#0: *29475 limiting requests, excess:
30.536 by zone "forward", client:

Can you see an issue with my configuration, or is there a bug with nginx in
respect to using custom variables?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,253572,253572#msg-253572

More information about the nginx mailing list