需求
將尾號ip爲 0或者 爲具體ip 的真實用戶轉發至其他雲服務上
架構
阿里雲slb--> k8s nginx ingress --> nginx pod
(以下nginx 配置爲nginx pod裏的轉發配置)
nginx ip分流 (以ip尾號爲0或者1 的客戶端ip進行分流)
root /data/build;
location / {
#if ( \$http_x_forwarded_for = '39.9.1.2'){
#proxy_pass http://10.12.12.2:8082;
#break;
#}
if ( \$http_x_forwarded_for ~* ^(.*)\.(.*)\.(.*)\.*[01]\$){
proxy_pass http://10.12.12.2:8082;
break;
}