lighttpd无法在代理后无法得到真实IP?

| | Comments (0) | TrackBacks (0)
lighttpdNginx结合使用, Nginx在前端作为反向代理, 由Apache和Lighttpd处理请求,并且记录access_log
Nginx和Lighttpd及Apache是通过lo进行数据交换的,lo中过滤出来的数据是有真实IP的。
Nginx设置
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
Squid也可以设置相应的HTTP Header
但是,access_log中,Apache可以得到Real Remote IP, 但是Lighttpd只能得到127.0.0.1.  lvs使用Lighttpd没有这个问题
原因(来源)是:
Lighttpd开发人员认为, 所有通过X-Forwarded-For的来的IP不一定是真实的,有些可以Trust,有些不能,所以出去安全的考虑, Lighttpd在1.4.13之后添加了一个名为mod_extforward的module,并且在版本1.4.18的时候释出了一个稳定版本. mod_extforward是Apache mod_extract_forwarded的Lighttpd实现,功能雷同, 通过extforward.forwarder = ("10.0.0.232" => "trust")的表达式来标定来源安全的主机。
mod_extforward在默认的lighttpd.conf中没有写入。
mod_extforward必须在mod_accesslog之后加载。

ps:之前rinetd测试端口转发的时候发现sina后端主机严格限定了请求来源, 对非前端主机的请求报错。

0 引用回复

下列是引用此篇的博客地址: lighttpd无法在代理后无法得到真实IP?.

本篇引用回复地址: http://www.renwenyue.com/mt/mt-tb.cgi/54

添加评论

关于这篇文章

This page contains a single entry by suchasplus published on July 28, 2008 12:19 AM.

[CPAN]perl module install memo was the previous entry in this blog.

ps3 + HDMI如何接音箱 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.