码迷,mamicode.com
首页 > 其他好文 > 详细

nginx + varnish + nginx 获取客户端地址

时间:2016-04-12 19:19:31      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

nginx 

http {

...

set_real_ip_from 153.37.232.0/24;

real_ip_header X-Forwarded-For;

...

}

 

varnish

sub vcl_recv {
...
if (req.restarts == 0) {
  if (req.http.X-Forwarded-For) {
  set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
  } else {
    set req.http.X-Forwarded-For = client.ip;
  }
}

...

}

 

 

nginx

http {

...

set_real_ip_from 10.0.0.0/8;

real_ip_header X-Real-IP;

...

}

 

nginx + varnish + nginx 获取客户端地址

标签:

原文地址:http://www.cnblogs.com/zenghui940/p/5383736.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!