近来折腾haproxy,测试中发现我使用IE和curl发送请求头中为http1.1,但是haproxy的响应头是http1.0。
后来尝试1.4.22,1.4.21,1.4.19都相同效果。
不知道大家有没有遇到过这状况,怎么解决的。
如下:
# curl http://10.10.77.67/car/120/32/65/Img1646532_120.jpg -H host:m2.auto.it.cn -o /dev/null -v
* Trying 10.10.77.67... connected
> GET /car/120/32/65/Img1646532_120.jpg HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.1.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2
> Accept: /
> host:m2.auto.it.cn
>
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: nginx/0.8.55
< Date: Thu, 18 Oct 2012 09:04:20 GMT
< Content-Type: image/jpeg
< Content-Length: 4634
< Last-Modified: Wed, 25 Jul 2012 02:35:21 GMT
< Expires: Sun, 16 Oct 2022 09:04:20 GMT
< Cache-Control: max-age=315360000
< Accept-Ranges: bytes
< Age: 67409
< X-Cache: HIT from 106_213.auto.it.cn
< Via: 1.1 106_213.auto.it.cn:81 (squid/2.7.STABLE9)
< Connection: close
<
{ [data not shown]
100 4634 100 4634 0 0 1216k 0 --:--:-- --:--:-- --:--:-- 4525k* Closing connection #0
详细配置文件如下:
# grep -v ^'#' haproxy.cfg
global
log 127.0.0.1 local3 info
maxconn 8000
ulimit-n 16014
user haproxy
group haproxy
chroot /opt/haproxy1.4.22/
pidfile /opt/haproxy1.4.22/logs/haproxy.pid
nbproc 1
daemon
defaults
mode http
log global
option httplog
timeout connect 10s
timeout client 10s
timeout server 10s
timeout check 2s
listen .auto.it.cn
bind *:80
log global
option httplog
monitor-net 192.168.106.0/24
monitor-uri /haproxy.test
balance uri
log 127.0.0.1 local0 debug
hash-type consistent
server cache2 192.168.106.109:81 check inter 1500 rise 3 fall 3 weight 12
server cache3 192.168.106.213:81 check inter 1500 rise 3 fall 3 weight 12
http-check send-state
fullconn 6000
retries 3
option redispatch
option httpchk GET /flag.txt HTTP/1.0\nHost:\ m1.auto.it.cn
http-check expect status 200
listen haproxystat
bind *:6501
stats enable
stats uri /haproxy-stats
stats realm Haproxy/Statistics
stats auth admin:admin
stats hide-version
haproxy 不支持 HTTP/1.1 吧?
######
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。