Images stored on Amazon AWS S3 are not displayed in Internet Explorer

For my AdLit web application, I store some images on Amazon AWS S3. But these images are not displayed in any version of Internet Explorer (tested with IE8, IE9 and IE11).

you can check this:

http://www.adlit.be/team

Images are displayed in Safari, Firefox, and Chrome, but not in Internet Explorer.

Does anyone have any experience with this issue? And how can this be fixed?

thanks for your help,

Anthony

+5
source share
2 answers

octet-stream - and - nosniff.png


According to the W3C specification , images usually get mime-sniffed regardless of what is declared in the response of the Content-Type header of the server.

But since there is also MS-proprietary X-Content-Type-Options: nosniff , IE does not perform the mime-sniff step in this case. And therefore, for W3C, the Content-Type header gives the final mime type. But this is "application / octet-stream", which is not a supported image type.


AdLit-Team.png
(Fiddler Filter - Click to Enlarge)

+6
source

Photos are JPEG images, but they are all called image without extension. This means that your server does not provide them with a Content-Type image. Instead, the server sends an HTTP header:

 Content-Type:application/octet-stream 

Chrome and Firefox are apparently smart enough to notice that the request comes from the <img> element and recognize the JPEG format from the binary content itself. But you will make it a lot easier if you get a server to send a more appropriate header:

 Content-Type:image/jpeg 

I have two guesses:

  • If you rename your photos on the server from image to image.jpg or image.jpeg , then your server will select the correct content type and
  • Given the correct Content-Type IE will display the photos.

Oh wait, Amazon S3. I think the S3 web service will infer the Content-Type from the file extension, but if you cannot explicitly set the metadata on S3 objects , including (especially) the Content-Type.

+2
source

Source: https://habr.com/ru/post/1216266/


All Articles