HttpRealipModuleChs
(Redirected from NginxChsHttpRealIpModule)
Contents |
[edit] HttpRealIpModule模块简介
这个模块允许从请求Headers里更改客户端的IP地址值(例如 实时的转发)。
它是有用的,如果nginx后面有多层负载均衡/代理,nginx转发请求时将会添加添加客户端的IP头。
这个模块是不是建立在默认情况下,需要这样启用它
--with-http_realip_module
用户评论:“你将建立一个值得信赖的代理列表(见下文)和客户端的IP第一个IP头中的信任是不是会被使用。” 来源:模块是Apache自述 mod_extract 。 信息十分丰富,为什么以及如何安全功能是很有帮助的。
例如
set_real_ip_from 192.168.1.0/24; set_real_ip_from 192.168.2.1; real_ip_header X-Real-IP;
[edit] 指令
[edit] set_real_ip_from
语法: set_real_ip_from [the address|CIDR]
默认值: 无
作用域: http, server, location
此指令描述了值得信赖的地址,这可以让nginx更准确的替换地址。
[edit] real_ip_header
语法: real_ip_header [X-Real-IP|X-Forwarded-For]
默认值: real_ip_header X-Real-IP
作用域: http, server, location
此指令设置了IP地址头转发替换使用。










