I’m having trouble in getting Nginx to gzip my pages that are served as
application/xhtml+xml
In my nginx.conf http block I have the following:
/ gzip on;
gzip_comp_level 3;
gzip_proxied any;
gzip_types text/plain text/html text/css application/x-javascript
text/xml application/xml application/xhtml+xml application/xml+rss
text/javascript;//
/In mime.types I commented out the existing xhtml entry and added
/ application/xhtml+xml xhtml;/
//
So a plain text file with .xhtml extension is served with content-type
application/xhtml+xml, but it is not being gzipped for some reason? CSS
and javascript are being gzipped okay though.
The response headers for my test xhtml page look like this:
/HTTP/1.1 200 OK
Server: nginx
Date: Fri, 27 Nov 2009 13:23:33 GMT
Content-Type: application/xhtml+xml
Connection: keep-alive
Content-Length: 11
Last-Modified: Fri, 27 Nov 2009 13:13:42 GMT
Accept-Ranges: bytes/
Can anyone help me get my pages gzipped with content type header of
/application/xhtml+xml/?
Thanks
Dave
On Fri, Nov 27, 2009 at 01:27:16PM +0000, Dave Kennard wrote:
Date: Fri, 27 Nov 2009 13:23:33 GMT
Content-Type: application/xhtml+xml
Connection: keep-alive
Content-Length: 11
Last-Modified: Fri, 27 Nov 2009 13:13:42 GMT
Accept-Ranges: bytes/
Can anyone help me get my pages gzipped with content type header of
/application/xhtml+xml/?
Because, by default gzip_min_length is 20. The page is too small.
–
Igor S.
http://sysoev.ru/en/
Thanks, I didn’t think about the content-length. But I’m still having
the same problem with larger pages not being gzipped:
e.g.
Browser request:
GET /xhtml.xhtml HTTP/1.1
Host: www.domain.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.5)
Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Authorization: Basic password
Response:
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 28 Nov 2009 11:44:22 GMT
Content-Type: application/xhtml+xml
Connection: keep-alive
Content-Length: 732
Last-Modified: Sat, 28 Nov 2009 09:38:10 GMT
Accept-Ranges: bytes
I forgot to mention what version of Nginx I’m running - it’s
nginx/0.7.6. Also, my webhost runs Nginx on the front end, which proxies
requests to my installation of Nginx. I don’t know if this would make
any difference (I did check it was my installation that was gzipping the
css and js by turning off gzip and then checking if the css and js were
still being gzipped or not, and they weren’t, so my installation can
definitely gzip files okay, just seems like it won’t gzip
application/xhtml+xml files).
Thanks
Dave