What gzip_types are recommended?

KT Walrus kevin at my.walr.us
Wed Dec 10 07:50:23 MSK 2008


Is there a delete_header or replace_header directive?

I'm trying to specify the character encoding for my css file, and this  
results in two Content-Type headers:

HTTP/1.1 200 OK
Server: nginx/0.6.34
Date: Wed, 10 Dec 2008 04:43:16 GMT
Content-Type: text/css
Content-Length: 12577
Last-Modified: Wed, 10 Dec 2008 02:39:22 GMT
Connection: keep-alive
Cache-Control: max-age=86400, must-revalidate
Content-Type: text/css; charset=iso-8859-1
Accept-Ranges: bytes

I suppose this is a mostly pointless thing to do, but I'm trying to  
learn how nginx works with headers.

I expected that when I did "add_header Content-Type" that it would  
have the option of replacing any existing header.


On Dec 9, 2008, at 6:34 PM, mike wrote:

> On Tue, Dec 9, 2008 at 1:40 PM, KT Walrus <kevin at my.walr.us> wrote:
>> What gzip_types are safe to compress with most  browsers?  Can  
>> javascript
>> and css be safely compressed?
> I have this
> gzip_types text/plain text/css application/x-javascript text/xml
> application/xml application/xml+rss text/javascript;
> seems to work well. Never had any complaints.
>> http://wiki.codemongers.com/NginxHttpGzipModule#gzip_types
>> Might be nice to update the link above with the answer.
>> Also, can I make sure that Javascript and CSS files are cached for  
>> the user
>> and can I set an Expires: time for these file types?
> Yes
> location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
>        expires max;
> }
>> Thanks.  I'm new to nginx and I am trying it out to see how much it  
>> helps
>> with performance for a PHP coded forum site.
> http://getfirebug.com + yslow! for firefox. makes determining this  
> stuff easy

More information about the nginx mailing list