What gzip_types are recommended?

mike mike503 at gmail.com
Wed Dec 10 09:54:08 MSK 2008


You can add additional headers but the proper headers for normal HTTP
behavior will be sent automatically by nginx. You only need to add
different headers that aren't already included. Or you can push
headers through using a server-side language like PHP too..


On Tue, Dec 9, 2008 at 10:44 PM, KT Walrus <kevin at my.walr.us> wrote:
> I was just thinking that it might be good to say what charset the .css uses
> rather than relying on the browser to default to the correct encoding.
>
> As I said, I'm just trying to learn and this particular example of replacing
> a header might not be the best, but I would like to understand how to
> replace headers.
>
> On Dec 10, 2008, at 12:15 AM, mike wrote:
>
>> why would you add a header that is already sent by default?
>>
>> On Tue, Dec 9, 2008 at 8:50 PM, KT Walrus <kevin at my.walr.us> wrote:
>>>
>>> Thanks.
>>>
>>> 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.
>>>
>>> Kevin
>>>
>>> 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