Some images fails to load on IE.

DOM7009: Unable to decode image at URL: '[some unique url]'.

The URL are set to sites/default/files/styles/image/image_name.jpg?itok=RANDTOKEN

I can fix the error by removing the header in .htaccess

Header always set X-Content-Type-Options nosniff

But that does not seem to be a right solution. Any ideas why it behaves like this?


1 Answer 1


I'm inclined to believe this is a MIME type (or Content Type) configuration issue on the server because the "X-Content-Type-Options nosniff" would bypass this kind of problem. That header is telling Internet Explorer to not extract MIME type info from the server response.

IE is very unforgiving these days (since IE 10 or so) with respect to the MIME type reported by the server. If your server is reporting that Jpegs are text or pngs, for example, Internet Explorer will fail to render it even if the extension is a well-known extension like "jpg."

Adding/Correcting MIME Types in Apache

You have many different ways to fix your server's reported mime type.

.htaccess (overrides server configuration)

If you're stuck with just editing your .htaccess file, add AddType image/jpeg jpeg jpg jpe to it in order to override whatever is happening with the server.

mime.types or httpd.conf (actually fixing the server configuration)

If you have full access to your server, try to locate the "mime.types" file on your server (assuming it exists) or add the "AddType" line to your httpd.conf file if jpegs aren't defined anywhere. It's possible that the "jpg" extension or "jpeg" MIME type already exists in one of these files and is just not correctly configured.

A restart of Apache will make sure config changes are in place when you see if the problem is fixed, too.

See also

If this problem persists, there is also another question in Stack Overflow at: https://stackoverflow.com/questions/27934411/images-failing-to-load-in-ie-with-dom-7009-error-unable-to-decode-in-console that has many alternative causes.

  • For the common image types: AddType image/jpeg .jpeg .jpg .jpe .JPG AddType image/gif .gif .GIF AddType image/png .png Apr 9, 2019 at 10:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.