一、nginx原生方法
依赖:–with-http_realip_module
作用域:http/server/location
deny/allow
二、nginx map方式
作用域:http(配置规则)
map $http_x_forwarded_for $sync-rdsdubbo-ddy {
default false;
39.98.49.91 true;
}
作用域:server(定义处理逻辑)
server_name ...;
if ( $sync-rdsdubbo-ddy = 'false' ) { return 403; }
location / { ... }
三、nginx 逻辑处理
作用域:
if ($http_x_real_ip != 115.115.82.210) {
return 403;
}