Facing content-type issue with try_files.

Makailol Charls makailol7 at gmail.com
Fri May 2 05:12:27 UTC 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140502/cc23981e/attachment.html>


More information about the nginx mailing list