Issues with default_type

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/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

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.

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

On Tue, Apr 13, 2010 at 19:39, James G [email protected] 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?