# Override proxy's incorrect Content-Type via mime settings

**URL:** <https://www.ruby-forum.com/t/override-proxys-incorrect-content-type-via-mime-settings/212153>\
**Category:** NGINX\
**Created:** [September 23, 2011, 6:38pm UTC](https://www.ruby-forum.com/t/override-proxys-incorrect-content-type-via-mime-settings/212153 "2011-09-23T18:38:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [September 23, 2011, 6:38pm UTC](https://www.ruby-forum.com/t/override-proxys-incorrect-content-type-via-mime-settings/212153/1 "2011-09-23T18:38:21Z")

</div>

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](http://www.jpluscplusm.com/contact.html)

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [September 23, 2011, 6:46pm UTC](https://www.ruby-forum.com/t/override-proxys-incorrect-content-type-via-mime-settings/212153/2 "2011-09-23T18:46:22Z")

</div>

On 23 September 2011 17:37, Jonathan M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

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

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [September 28, 2011, 12:24am UTC](https://www.ruby-forum.com/t/override-proxys-incorrect-content-type-via-mime-settings/212153/3 "2011-09-28T00:24:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [September 24, 2013, 12:45am UTC](https://www.ruby-forum.com/t/override-proxys-incorrect-content-type-via-mime-settings/212153/4 "2013-09-24T00:45:10Z")

</div>

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:

> **[Re: Override proxy's incorrect Content-Type via mime settings](https://forum.nginx.org/read.php?2,215744,243078#msg-243078)**
>
> 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...
