compression-at-edge, in front of varnish reverse proxy, gzip-compresses some content, but not other ?
Ben DJ
bendj095124367913213465 at gmail.com
Wed Apr 28 17:22:33 CEST 2010
Laurence,
On Wed, Apr 28, 2010 at 6:53 AM, Laurence Rowe <l at lrowe.co.uk> wrote:
> OK, it looks like there is something strange set up on one of your
> backend servers - the js is being served with Content-Type: text/x-js.
> You should probably fix that, or just add it to gzip_types.
This looks like the cause,
grep js /etc/apache2/mime.types
application/javascript js
text/x-js js
defined in the standard distro-release of apache2. not mentioned at
all in the rfc (http://www.ietf.org/rfc/rfc4329.txt), but widely used,
apparently, nonetheless. so, added it to gzip types, and tried again.
also added to nginx config,
proxy_set_header Accept-Encoding "";
per recommend @ nginx list.
now, headers show BOTH js & css being compressed, as intended, e.g.,
----------------------------------------------------------
https://my.site.com/apostrophePlugin/js/jquery.autogrow.js
GET /apostrophePlugin/js/jquery.autogrow.js HTTP/1.1
Host: my.site.com
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.4) Gecko/20100417
Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: https://my.site.com/
Cookie: symfony=R%2Cq-BqTdX-ckfGCqHa2MnDsbJpd
HTTP/1.1 200 OK
Server: nginx/0.8.35
Date: Wed, 28 Apr 2010 15:09:34 GMT
Content-Type: text/x-js
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Last-Modified: Wed, 28 Apr 2010 04:42:23 GMT
Etag: "267f6-db6-48544a2d549c0"
Cache-Control: max-age=259200
Expires: Sat, 01 May 2010 15:09:34 GMT
X-Varnish: 1289869751 1289869733
Age: 283
Via: 1.1 varnish
Content-Encoding: gzip
----------------------------------------------------------
https://my.site.com/apostrophePlugin/css/a.css
GET /apostrophePlugin/css/a.css HTTP/1.1
Host: my.site.com
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.4) Gecko/20100417
Accept: text/css,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: https://my.site.com/
Cookie: symfony=R%2Cq-BqTdX-ckfGCqHa2MnDsbJpd
HTTP/1.1 200 OK
Server: nginx/0.8.35
Date: Wed, 28 Apr 2010 15:09:34 GMT
Content-Type: text/css
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Last-Modified: Wed, 28 Apr 2010 04:42:21 GMT
Etag: "26233-14e26-48544a2b6c540"
Cache-Control: max-age=259200
Expires: Sat, 01 May 2010 15:09:34 GMT
X-Varnish: 1289869748
Age: 0
Via: 1.1 varnish
Content-Encoding: gzip
----------------------------------------------------------
AND, the YSlow plugin now 'grades' the page an "A".
Thanks for the help!
Ben
More information about the varnish-misc
mailing list