我正在使用haproxy和nginx来负载平衡,以及保护(通过Nginx的nginx)我的networking服务器。 Haproxy工作正常,但是通过nginx发送它的一分钟,它将所有内容默认为默认的后端,而不是检查我们的webmail后端。 在nginx错误和访问日志中,它显示正确的主机名,但仍然被发送到default_backend bk_comweb而不是use_backend bk_webmail。 有一些我失踪,但无法通过树木看到森林,任何帮助将不胜感激!
haproxy.conf重要行:
frontend ft_protection bind 10.0.5.15:80 mode http option http-server-close #DDOS protection #Use General Purpose Couter (gpc) 0 in SC1 as a global abuse counter #Monitors the number of request sent by an IP over a period of 10 seconds stick-table type ip size 1m expire 1m store gpc0,http_req_rate(10s),http_err_rate(10s) tcp-request connection track-sc1 src tcp-request connection reject if { sc1_get_gpc0 gt 0 } #Abuser means more than 100reqs/10s acl abuse sc1_http_req_rate gt 100 acl kill sc1_inc_gpc0 gt 10 acl save sc1_clr_gpc0 ge 0 tcp-request connection accept if !abuse save tcp-request connection reject if abuse kill default_backend bk_protection
后端bk_protection模式http选项http-server-close#如果源IP在定义的时间段内生成了10个或更多的http请求,#flag IP作为前端的滥用者acl abuse scl_http_err_rate gt 10 acl kill sc1_inc_gpc0 gt 0 tcp-request content reject如果滥用杀服务器waf1 10.0.5.3:81 maxconn 10000检查
前端ft_web绑定10.0.6.3:81模式http选项http-server-close acl webmail hdr(主机)-i newwebmail.example.com acl comwebmail hdr_beg(主机)-i webmail use_backend bk_webmail如果webmail或comwebmail default_backend bk_comweb
nginx.conf:
http { include /etc/nginx/naxsi_core.rules; include mime.types; server_names_hash_bucket_size 128;
http { include /etc/nginx/naxsi_core.rules; include mime.types; server_names_hash_bucket_size 128;
发送文件;
keepalive_timeout 65;
tcp_nodelay;
gzip on;
gzip_disable“MSIE [1-6]。(?!。* SV1)”;
服务器{
proxy_set_header代理连接“”;
听10.0.5.3:81;
位置 / {
包括/etc/nginx/test.rules;
proxy_pass http://10.0.6.3:81/ ;
}
error_page 403 / 403.html;
location = /403.html {
root / opt / nginx / html;
内部;
}
位置/ RequestDenied {
返回403;
}
}
}
解决:我需要添加proxy_set_header主机$主机; 到服务器部分。