Am 10.01.2017 um 15:48 schrieb Yossi Nachum:
I have apache traffic server around the world that are behind haproxy
servers.

Can I compress the traffic between haproxy and the trafficserver to save
bandwidth?

makes not much sense

when correctly configured the backend server does compresison with mod_deflate and ATS stores a compressed and a uncompressed copy depending on the Acept-Encoding from the client

there is no point in compress already compressed data again, it only makes the data bigger because it adds overhead for the compression headers and latency will grow

keep in mind that in these days most clients support compression and so the overhead for the few clients which don't is not relevant

better configure your backend server properly to make sure ATS stores a compressed and a uncompressed copy to serve all clients correctly

the idea of the snippet below is that PHP scripts may generate different content based on user-agent while static files are always the same, hence Header unset "Vary" for them and finally hang it on the Accept-Encoding, for a .php file httpd would send "Vary: User-Agent, Accept-Encoding" and for a .txt "Vary: Accept-Encoding"

# Properly handle requests behind proxies
<IfModule mod_headers.c>
 <FilesMatch "\.(php)$">
  Header append "Vary" "User-Agent"
 </FilesMatch>
<FilesMatch "\.(gif|jpe?g|png|htm|html|xml|sgm|sgml|css|js|txt|htc|ico|flv|mp4|m4v|wmv|mov|mpg|ogv|webm|mp3|wav|ogg|oga|swf|doc|docx|xls|xlsx|ppt|pptx|pdf|eot|ttf|otf|woff)$">
  Header unset "Vary"
 </FilesMatch>
<FilesMatch "\.(htm|html|xml|sgm|sgml|css|js|txt|htc|wav|doc|docx|xls|xlsx|ppt|pptx|pdf|eot|ttf|otf|woff)$">
  Header set "Vary" "Accept-Encoding"
 </FilesMatch>
</IfModule>

Reply via email to