Welcome! Log In Create A New Profile

Advanced

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

July 14, 2009 04:07AM
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
Subject Author Posted

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

bavery July 14, 2009 04:07AM

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

bavery July 16, 2009 04:55AM

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

Igor Sysoev July 16, 2009 08:51AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 326
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready