set_real_ip_from --how to load IP list file ?

...²º¹³ 416626442 at qq.com
Sun Nov 8 06:47:03 UTC 2015


Hi,
  I'm using CDN with my site.
There are many IPs on network.
set_real_ip_from only can add IP in one line.
I want to add IP list to  file and load it .
How to set ?


PS:   Apache Module mod_remoteip have  RemoteIPTrustedProxyList for this.
But I just want to use nginx.


http://httpd.apache.org/docs/2.4/mod/mod_remoteip.html 

RemoteIPTrustedProxyList Directive
Description:Declare client intranet IP addresses trusted to present the RemoteIPHeader value
Syntax:RemoteIPTrustedProxyList filename
Context:server config, virtual host
Status:Base
Module:mod_remoteip

The RemoteIPTrustedProxyList directive specifies a file parsed at startup, and builds a list of addresses (or address blocks) to trust as presenting a valid RemoteIPHeader value of the useragent IP.

The '#' hash character designates a comment line, otherwise each whitespace or newline separated entry is processed identically to the RemoteIPTrustedProxy directive.

Trusted (Load Balancer) Example
RemoteIPHeader X-Forwarded-For RemoteIPTrustedProxyList conf/trusted-proxies.lst

conf/trusted-proxies.lst contents

# Identified external proxies;
192.0.2.16/28 #wap phone group of proxies
proxy.isp.example.com #some well known ISP
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20151108/9065caa8/attachment.html>


More information about the nginx mailing list