Nginx offers downoload SVG instead of showing it

I am trying to show an SVG file in HTML or in a separate tab, but Nginx suggests downloading it. I took a regular SVG file that works on another site, but not on my server.

Where is the problem?

There is an example http://proximax.ru/media/content/final/plane2.svg Also here is SVG in HTML http://proximax.ru/index/

+6
mime nginx svg
source share
3 answers

Your image is marked as application/octet-stream , which the browser can only offer for download, as it does not know how to interpret it.

It can be seen from your index.html file that you played with variations of the MIME type, and it is not clear whether the standard requires image / svg or image / svg + xml (or standards are what they are, something else is complete).

+4
source share

I fixed it. I added in /etc/nginx/mime.types

 image/svg+xml svg svgz; 

Then I checked the server responses correctly

 wget -O - -S http://proximax.ru/media/content/final/avW30U.svg > /dev/null .. Content-Type: image/svg+xml .. 

I also disabled other virtual spaces to be clear.

+13
source share

In my case, I set default_type application/octet-stream; after include mime.types; due to a problem. And just switch them, fixing it. ^ _ ^

0
source share

All Articles