lighttpd+resin联动设置

lighttpd.conf文件的内容,假设resin运行在8080口:
proxy.server = (
“.jsp” => ( ( “host” => “192.168.0.2”, “port” => 8080 ) ,
“.do” => ( ( “host” => “192.168.0.2”, “port” => 8080 ),
“/help” => ( ( “host” => “192.168.0.2”, “port” => 8080 )
)
记得要在server.modules中把”mod_proxy”前的注释去掉。

lighttpd代理转发之后会resin不能获取客户端ip,所以应用要改一下。

public String getIpAddr(HttpServletRequest request) {
String ip = request.getHeader(“x-forwarded-for”);
if(ip == null || ip.length() == 0 || “unknown”.equalsIgnoreCase(ip)) {
ip = request.getHeader(“Proxy-Client-IP”);
}
if(ip == null || ip.length() == 0 || “unknown”.equalsIgnoreCase(ip)) {
ip = request.getHeader(“WL-Proxy-Client-IP”);
}
if(ip == null || ip.length() == 0 || “unknown”.equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
return ip;
}

发表您的评论

邮箱地址不会被公开。 必填项已用*标注

*

code