HAProxy的壓縮功能
haproxy還支持http協議的壓縮機制,常用的算法有gzip和deflate。
壓縮的功能僅在7層有效,用戶在請求時會先將瀏覽器支持的壓縮算法發送給服務器,然後使用相同的壓縮算法將數據返回給用戶
壓縮的使用方法
1.修改配置文件
frontend web
bind 172.20.27.20:80
mode http #haproxy要啓用壓縮功能必須是在7層
compression algo gzip deflate #開啓壓縮功能及所支持的壓縮格式
compression type text/plain text/html text/css text/xml text/javascript #壓縮的類型
use_backend web_server
backend web_server
server web1 192.168.27.21 check port 80 inter 3s fall 3 rise 5
server web1 192.168.27.22 check port 80 inter 3s fall 3 rise 5
2.測試