problem w/ gzip when hiding Content-Type header from upstream server

Igor Sysoev is at
Thu Jul 16 16:51:35 MSD 2009

On Thu, Jul 16, 2009 at 04:55:00AM -0400, bavery wrote:

> I did some more checking, and am now finding that other .js & .css files from the upstream server are not being compressed as well, except that these files simply are served from the upstream server with no content-type header at all. 
> So why does nginx not recognize the file type it is handling based on mime-type configuration when dealing with proxied files?

nginx think that upstream should set Content-Type by itself.

Probably I need to extend "add_header" to set content type:

   location /combined.css {
        proxy_pass ..
        proxy_hide_header Content-Type;
        add_header        Content-Type  text/css;

or implement "override_type" to set content-type based on mime.types file
or just string:

   location /combined.css {
        proxy_pass ..
        override_type     [on|off|mime-type];

Igor Sysoev

More information about the nginx mailing list