Gzipping xhtml pages

Dave Kennard showerheadsuk at hotmail.com
Fri Nov 27 16:27:16 MSK 2009

I'm having trouble in getting Nginx to gzip my pages that are served as 

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 

/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 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20091127/9309224a/attachment.html>

More information about the nginx mailing list