I'm testing the speed of my CDN network by directly browsing to the addresses of images that are stored on it. Some of these images are in jpg format while others are in jpeg format.

I've noticed that when i browse the address of a jpg file the image is always displayed by default. When i check the network tab of the inspect menu in google chrome or similar browsers i also see that the response is always displayed under the response type img. However when its a jpeg file the browser always downloads it as a document by default and the response can only be found under the doc response type. So the browser doesn't treat it as an image at all, even though it is.

So why is this the case? Aren't jpg and jpeg pretty much the same thing?

  • If you don't mind, try file-renaming one of your jpeg files to be jpg, then try loading it through the CDN again. If the browser displays it normally as a jpg, that would confirm my suspicion that it's not about the file itself, it's about the server software (the CDN's built-in software) reading the file extensions and serving them up with different HTTP headers. Perhaps it knows it needs to serve jpg "as an image", but just sees jpeg as a generic "file". If so, it may be a mime-type thing. Jan 5, 2022 at 6:15
  • There is no "jpg format while others are in jpeg format.". There is a single format, not 2, it is called JPEG. As for the extensions, it is only because of bad OS that one needs to use .jpg and this was long ago. There is really no reason today to continue doing that. Jan 5, 2022 at 7:50

1 Answer 1


Thia is likely due to the way the CDN is set up. When an object is sent by the web server, the server typically asvisises the "mime type" - a string advising the kind of object - to the browser to encourage the browser to handle it in an appropriate way.

It sounds like the CDN does not have a mapping for ".jpeg". (Of-course, it could also be the CDN has a mapping and your computer is interpretting it differently).

  • 1
    I'm on my cell, so havn't tried it properly, but try pasting the urls into fabianstiehle.com/mimetype which I think will return the mime type.
    – davidgo
    Jan 5, 2022 at 6:26
  • 3
    I don't think CDNs typically control the mime type. They just pass the mime type from the origin server along. Jan 5, 2022 at 11:16
  • 1
    @StephenOstermiller - I largely agree - but if the objects live in the CDN as appears to be the case here per the users first sentence (he specifically states images are stored), the CDN is a web server.
    – davidgo
    Jan 5, 2022 at 16:00
  • @davidgo i'm using AWS s3 and cloudfront to serve the images. So the images are stored in s3 and cached in cloudfront.
    – Maurice
    Jan 5, 2022 at 20:48
  • 2
    @davidgo i just confirmed that the browser issue was caused because my application did not set the mimetype. I've changed the code so that the mimetype is included on each upload and now the image is displayed normally again, Thank you!
    – Maurice
    Jan 5, 2022 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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