nginx屏蔽cdn传递过来的客户端ip


首先cdn服务端开启$proxy_add_x_forwarded_for,源站加入$proxy_add_x_forwarded_for参数,然后添加一下参数来屏蔽真实客户端ip。

if ($proxy_add_x_forwarded_for ~* "114.114.114.114") {
return 403;
break;
}


Whatever is worth doing is worth doing well.