Squid2.6反向代理实现Web缓存加速
主要的改进
1、融合加速和反向功能
Major improvements to the way that Squid handles web proxy, accelerated and transparent proxy requests to make it easier to configure transparent and acceleration functionality. The default behaviour is to function as a standard HTTP proxy on each port that Squid is configured to listen on, but in addition in this release the keywords "accelerated" and "transparent" can be specified after each port to indicate to Squid the functionality that is to be enabled on that port. This means that the old config directives relating to httpd_accel_* are now deprecated.
2、行为分析
Logging enhancements to allow even greater customization of the way Squid logs requests in the access-log or to syslog if required
Support for parsing X-Forwarded-For headers allowing access controls to be based on the real client IP even if behind secondary proxies
Support for Etag and Vary HTTP headers. This further moves Squid towards HTTP/1.1 compliance. The Vary header field is used for improved caching and delivery of customized content to end clients, and the Etag is used similar to an MD5 checksum between client and server to determine if a web page has changed since it was last retrieved.
由于
httpd_accel_host 被http_port、cache_peer选项替代
httpd_accel_port 由cache_port来定义
httpd_accel_uses_host_header由http_port vhost选项替代
则
------------------------- ---------------------------
ajax.aaa .com 请求 / | Squid | / 127.0.0.1 ajax.aaa.com 80
Sns.xxx.com 请求 | | 211.100.100 sns.xxx.com 80
live.yyy.com 请求 -- | 10.10.10.10/11 | ---- 169.100.100 live.yyy.com 81
tag.zzz.com 请求 / | /etc/hosts | / 58.100.100 tag.zzz.com 82
------------------------- ---------------------------
ajax.aaa .com 请求 / | Squid | / 127.0.0.1 ajax.aaa.com 80
Sns.xxx.com 请求 | | 211.100.100 sns.xxx.com 80
live.yyy.com 请求 -- | 10.10.10.10/11 | ---- 169.100.100 live.yyy.com 81
tag.zzz.com 请求 / | /etc/hosts | / 58.100.100 tag.zzz.com 82
------------------------- ---------------------------
http_port 110.10.10.10:80 transparent vhost vport
cache_peer 127.0.0.1 parent 80 0 no-query originserver
cache_peer
211.100.100 parent 80 0 no-query originserver
cache_peer
169.100.100 parent 81 0 no-query originserver
cache_peer
58.100.100
parent 82 0 no-query originserver
2、Log改进
A、Log记录方式更改,可用记录至系统Log或access-log,引入X-Forwarded-For headers功能后,Log可直接通过后台web的log进行分析
B、X-Forwarded-For headers功能使后端被加速web的log更加便于分析,直接分析后端web的log即可分析用户行为,原先版本后端web的log日志全来自前端squid机器,无法从后端直接分析log