Welcome! Log In Create A New Profile

Advanced

Re: Facing content-type issue with try_files.

Makailol Charls
May 06, 2014 12:40AM
Hello,

Could someone help me with my previous query?

Actually the problem is that when image file doesn't have an extension it
is not being served with proper content type. Instead it is served with
"application/octet-stream" content-type. Due to this browser try to
download image instead of displaying it.

Is it necessary to have an extension to image file to set proper
content-type for Nginx? Couldn't web server set the content-type from *file
type* ?

Thanks,



On Fri, May 2, 2014 at 10:42 AM, Makailol Charls <makailol7@gmail.com>wrote:

> Hello,
>
> To serve static contents i.e. images I use try_files directive of Nginx.
> My configuration location block is as below.
>
> location ~* \.(jpg|jpeg|png|gif)$ {
> try_files $request_uri @missingImg;
> }
>
> @missingImg is named location block with proxy_* directive.
>
> The above configuration works fine if the image file name ends with jpg,
> gif, jpeg, png extension in disk. When image file name(stored in disk)
> includes query string like "example.jpg?a=123" then request to such image
> is being served with application/octet-stream content-type . Because of the
> wrong content type, image is not being displayed and browser prompt to
> download image.
>
> Could someone suggest me what am I doing wrong here?
>
> Thanks,
> Makailol
>
>
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Facing content-type issue with try_files.

Makailol Charls May 02, 2014 01:14AM

Re: Facing content-type issue with try_files.

Makailol Charls May 06, 2014 12:40AM

Re: Facing content-type issue with try_files.

Nicholas Sherlock May 08, 2014 12:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 148
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