# Issues with default\_type

**URL:** <https://www.ruby-forum.com/t/issues-with-default-type/186861>\
**Category:** NGINX\
**Created:** [April 13, 2010, 3:23pm UTC](https://www.ruby-forum.com/t/issues-with-default-type/186861 "2010-04-13T15:23:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 13, 2010, 3:23pm UTC](https://www.ruby-forum.com/t/issues-with-default-type/186861/1 "2010-04-13T15:23:11Z")

</div>

Here’s a snippet of my configuration:  
location /resource/image/  
{  
default\_type image/jpeg;  
add\_header Content-Type image/jpeg;  
mogilefs\_tracker 192.168.0.1:7001;  
mogilefs\_domain ‘repository:images’;

mogilefs\_pass  
{  
proxy\_pass $mogilefs\_path;  
proxy\_hide\_header Content-Type;  
proxy\_buffering off;  
}  
}

So I’ve set the default type, forced the header with add\_header, and  
told the proxy\_pass not to send the Content-Type header. So we should  
be getting the Content-Type of “image/jpeg”, right?  
$ curl -i  
[http://192.168.0.5/resource/image/af795ed0357e19afcc4a63bbcee1fd10](http://192.168.0.5/resource/image/af795ed0357e19afcc4a63bbcee1fd10)  
HTTP/1.1 200 OK  
Server: nginx/0.7.65  
Date: Tue, 13 Apr 2010 11:09:32 GMT  
Content-Type: text/plain  
Connection: keep-alive  
Content-Length: 25871  
Last-Modified: Tue, 09 Feb 2010 14:56:31 GMT  
Accept-Ranges: bytes

```
 ????JFIFdd?....

```

Maybe not. Is this because curl is sending silly accept headers? Well,  
let’s ask Wireshark:  
GET /resource/image/af795ed0357e19afcc4a63bbcee1fd10 HTTP/1.1  
User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3  
OpenSSL/0.9.7l zlib/1.2.3  
Host: 192.168.0.5  
Accept: _/_

Nope. In addtion to this Firefox shows the exact same headers being  
returned by the server. This does appear to be some sort of bug within  
either nginx, or the mogilefs module. At no other point in the  
configuration is add\_header, or default\_type being set. Even with a  
default\_type being set (of application/octet-stream) inside the top  
level of server{} block, the results remain the same.

Is this a bug, and if not, what have I done wrong?

Regards

~ James

Lasgo Chrysalis Limited. Registered in England & Wales No. 1380166.  
Part of the Chrysalis Plc.  
Registered office: The Chrysalis Building, Bramley Road, London W10 6SP

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 13, 2010, 6:25pm UTC](https://www.ruby-forum.com/t/issues-with-default-type/186861/2 "2010-04-13T18:25:55Z")

</div>

Hello!

On Tue, Apr 13, 2010 at 02:22:41PM +0100, James G wrote:

> ```
> proxy_pass $mogilefs_path;
> proxy_hide_header Content-Type;
> proxy_buffering off;
> 
> ```
> 
> }  
> }
> 
> So I’ve set the default type, forced the header with add\_header, and  
> told the proxy\_pass not to send the Content-Type header. So we  
> should be getting the Content-Type of “image/jpeg”, right?

Try setting default\_type in mogilefs\_pass{} block, it should fix  
your issue.

Maxim D.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 13, 2010, 7:40pm UTC](https://www.ruby-forum.com/t/issues-with-default-type/186861/3 "2010-04-13T19:40:18Z")

</div>

On 13 Apr 2010, at 17:25, Maxim D. wrote:

> > mogilefs\_domain ‘repository:images’;  
> > told the proxy\_pass not to send the Content-Type header. So we  
> > should be getting the Content-Type of “image/jpeg”, right?
> 
> Try setting default\_type in mogilefs\_pass{} block, it should fix  
> your issue.

Sadly, it hasn’t. I’m still getting Content-Type: text/plain back. Any  
other suggestions or ideas are welcome.

~ James

Lasgo Chrysalis Limited. Registered in England & Wales No. 1380166.  
Part of the Chrysalis Plc.  
Registered office: The Chrysalis Building, Bramley Road, London W10 6SP

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 13, 2010, 9:52pm UTC](https://www.ruby-forum.com/t/issues-with-default-type/186861/4 "2010-04-13T21:52:00Z")

</div>

On Tue, Apr 13, 2010 at 19:39, James G [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > ```
> > > default_type image/jpeg;
> > > 
> > > ```
> > > 
> > > }
> > > 
> > > So I’ve set the default type, forced the header with add\_header, and  
> > > told the proxy\_pass not to send the Content-Type header. So we  
> > > should be getting the Content-Type of “image/jpeg”, right?
> > 
> > Try setting default\_type in mogilefs\_pass{} block, it should fix  
> > your issue.
> 
> Sadly, it hasn’t. I’m still getting Content-Type: text/plain back. Any other  
> suggestions or ideas are welcome.

I suppose you moved _both_ (add\_header and default\_type), right?
