Override proxy's incorrect Content-Type via mime settings

Hi all -

I have an upstream proxy that sends the wrong Content-Type header for
a load of images. Sometime it doesn’t send any header at all.

I’m trying to get Nginx not only to remove the upstream’s Content-Type
header (“proxy_hide_header”), but also to insert the correct header.
Unfortunately, I can’t hard-code the value as there are a variety of
image formats being used. “proxy_hide_header” doesn’t seem to do
anything other than block the incorrect value, and
“proxy_ignore_headers” won’t accept “Content-Type”.

How can I both remote upstream’s incorrect header, and also add the
header than Nginx would have used if it were serving the content
from local disk?
In other words, how do I add the header with a value derived from the
MIME settings currently configured, via the requested file’s
extension?

Version 0.7.67, but can upgrade if required.

Many thanks,
Jonathan

Jonathan M.
London, UK
http://www.jpluscplusm.com/contact.html

On 23 September 2011 17:37, Jonathan M. [email protected]
wrote:

How can I both remote upstream’s incorrect header, and also add the
remove

Just a quick thread bump to see if anyone has any ideas …

Have same problem, but for different types of files.

I have found a workaround using “map” directive, where pattern is an URI
extension and value is a mime-type, but seems a little bit weird and
requires to create a map from all possible extension. Is there any way
to
reuse standard “mime.types” together with Content-Type detection by URI
extension?

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs