atom feed3 messages in ru.sysoev.nginxproblem w/ gzip when hiding Content-T...
FromSent OnAttachments
baveryJul 14, 2009 1:07 am 
baveryJul 16, 2009 1:54 am 
Igor SysoevJul 16, 2009 5:51 am 
Subject:problem w/ gzip when hiding Content-Type header from upstream server
From:bavery (ngin@nginx.us)
Date:Jul 14, 2009 1:07:24 am
List:ru.sysoev.nginx

I have the exact situation described in the wiki for the proxy_hide_header
command, where my upstream server sends my JS & CSS files with the wrong
Content-Type header. The file is currently being sent with a text/html
content-type from the upstream server, but I am experiencing some occasional
issues with browsers not rendering the CSS and suspect it may possibly be due to
not having the correct content-type header, since I have read that this can
sometimes cause the problems I am seeing.

location /combined.css { proxy_pass http://$proxyforwardto/v/vspfiles/assets/combined.css.asp; proxy_hide_header Content-Type;

I have the following line in my config file for specifying which file types gzip
should compress. gzip_types text/plain text/css application/x-javascript text/xml application/xml
application/xml+rss text/javascript;

My problem seems to be that once the Content-Type header is hidden with
proxy_hide_header, nginx does not seem to be attempting to determine the correct
type itself. My CSS & JS files are simply passed on uncompressed, with no
content-type header. Mime-types are configured correctly in my nginx config, but
it doesn't seem to make a difference for these particular files. I have tried
using proxy_set_header to specifically set the content-type header as text/css,
but nginx seems to completely ignore this and continues sending the file through
without changing the content-type header.

Is there something I am missing here? How can I get nginx to recognize that the
.css & .js files it is pulling from the upstream server should still be
compressed even though the Content-Type header is being hidden? I am running
nginx version 0.8.0.

Bryan

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,4037,4037#msg-4037