squid 3.1.8 如何支持http1.1

发布于 2022-09-30 19:02:40 字数 8517 浏览 11 评论 0

之前用的是squid2.6,但是对http11 支持不好,虽然squid2.7 设置参数可以支持http11,但是这些都是部分的。
看了下squid版本之间的对比,说squid3.0.xx 以上对http11完美支持。
           我采用squid3.1.8 虽然默认支持http11. 但是我获取header头信息还是http1.0,
几个对http11相关说明的参数有:
#  TAG: vary_ignore_expire      on|off
#       Many HTTP servers supporting Vary gives such objects
#       immediate expiry time with no cache-control header
#       when requested by a HTTP/1.0 client. This option
#       enables Squid to ignore such expiry times until
#       HTTP/1.1 is fully implemented.
#
#       WARNING: If turned on this may eventually cause some
#       varying objects not intended for caching to get cached.
#Default:
# vary_ignore_expire off
#  TAG: via     on|off
#       If set (default), Squid will include a Via header in requests and
#       replies as required by RFC2616.
#Default:
# via on

还有其他几个参数和后端服务有关的keepalive

但我获取的信息一致都是1.0
如:
响应头
响应头信息格式化头信息
HTTP/1.0 200 OKServer: nginx/0.7.67Date: Fri, 25 Mar 2011 06:25:04 GMTContent-Type: text/htmlX-Cache: MISS from jfeiyang3X-Cache-Lookup: MISS from f:80Via: 1.0 f3 (squid/3.1.Connection: close

请求头
GET /html/index.shtml HTTP/1.1Host: test.feiyang.ccUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: zh-cn,zh;q=0.5Accept-Encoding: gzip,deflateAccept-Charset: GB2312,utf-8;q=0.7,*;q=0.7Keep-Alive: 115Connection: keep-aliveCookie: user_ident=1301016306161063

附上配置文件

http_port 80 accel vhost vport transparent
#http_port 80 accel  vhost vport
icp_port 0
udp_incoming_address 0.0.0.0
udp_outgoing_address 255.255.255.255
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY

#ignore_expect_100 off
#httpd_accel_uses_host_header on
reply_header_max_size 64 KB
chunked_request_body_max_size 64 KB
request_body_max_size 0 KB
uri_whitespace encode
persistent_request_timeout 2 minute
client_persistent_connections on
server_persistent_connections on
via on
vary_ignore_expire off
#request_entities off
#strip_query_terms off
#server http11 on
persistent_request_timeout 5 seconds
client_persistent_connections off
server_persistent_connections on
forwarded_for on
acl apache rep_header Server ^Apache
#broken_vary_encoding allow apache
cache_mem 500 MB
maximum_object_size 16384 KB
minimum_object_size 0 KB
maximum_object_size_in_memory 384 KB
negative_ttl 1 second
cache_replacement_policy lru
memory_replacement_policy lru

cache_dir ufs /usr/local/cache2 2000 64 256
#logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv"  %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
#logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh %{host}>h
logformat combined %>a %ui %un [%tl] "%rm %ru  HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh %tr
strip_query_terms off
cache_access_log /usr/local/squid3.1/squidlogs/access.log squid
#cache_access_log /data0/squidlogs/access.log combined
cache_log /usr/local/squid3.1/squidlogs/squid.log
cache_store_log none
logfile_rotate 20
emulate_httpd_log on
cache_effective_user squid
cache_effective_group squid
pid_filename /data0/squidlogs/squid.pid
hosts_file /usr/local/squid3.1/etc/hosts.squid
mime_table /usr/local/squid3.1/etc/mime.conf
diskd_program /usr/local/squid3.1/libexec/diskd-daemon
unlinkd_program /usr/local/squid3.1/libexec/unlinkd
icon_directory /usr/local/squid3.1/share/icons
#error_directory /usr/local/squid3.1/etc/squid/errors/Simplify_Chinese
#Recommended minimum configuration:
#acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl Safe_ports port 80          # http
acl Safe_ports port 8080        # http
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT

#
acl LanDstDM dstdomain .feiyang.cc
acl PURGE method PURGE
acl CONNECT method CONNECT
acl inside src 192.168.1.0/24
acl allowed_ports port 80
acl allowed_ports port 8080
acl has_referer  referer_regex -i .
acl has_botagent browser -i googlebot
http_access allow !has_referer
http_access allow LanDstDM
http_access allow inside
http_access allow all
request_header_access All allow all

http_reply_access allow all
#duilie

acl PURGE method PURGE
http_access allow PURGE localhost
#http_access allow PURGE blog
http_access deny PURGE

#follow_x_forwarded_for allow all

#no_cache deny blog
no_cache deny localhost

#http_access allow manager blog
http_access allow manager localhost
acl monitor src 202.108.6.88
http_access allow manager monitor
http_access deny manager all

# http_access deny QUERY
http_access allow all
http_reply_access allow all
cachemgr_passwd none all
#icp_access allow blog_hosts
icp_access deny all
#reply_body_max_size 0 allow all

#always_direct allow allowed_doms
# always_direct allow all
##cache img
refresh_pattern ^ftp:       1440    20% 10080
refresh_pattern ^gopher:    1440    0%  1440
refresh_pattern .       0   20% 4320
#refresh_pattern -i \.css$       360    50%     2880    reload-into-ims
#refresh_pattern -i \.js$        1440    50%     2880    reload-into-ims
#refresh_pattern -i \.html$        720   50%     1440    reload-into-ims
#refresh_pattern -i \.jpg$       1440    90%     2880    ignore-reload
#refresh_pattern -i \.gif$       1440    90%     2880    ignore-reload
#refresh_pattern -i \.swf$       1440    90%     2880    ignore-reload
#refresh_pattern -i \.jpg$       1440      50%     2880    ignore-reload
#refresh_pattern -i \.png$       1440      50%     2880      ignore-reload
#refresh_pattern -i \.bmp$       1440      50%     2880      ignore-reload

#cache_peer
cache_peer test.feiyang.cc  parent 80 0 no-query originserver no-digest   name=test
#cache_peer 192.168.1.151 parent 80 0 no-query originserver no-digest
cache_peer_domain test test.feiyang.cc

请教squid3.1.x 对http11 支持如何进行设置!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爱你不解释 2022-10-07 19:02:40

顶一个,别让此贴沉底了!!!!!

独夜无伴 2022-10-07 19:02:40

继续,我也想知道

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文