DEV Community

Cover image for How MIME types crashed our production app
Matthew Epler
Matthew Epler

Posted on

How MIME types crashed our production app

As the sun came up on the East Coast of the Americas continent, an alarm went off in our team Slack channel. The homepage was returning 4XX errors.

The problem turned out to be related to two things, but one of those was so basic I didn't even think of it. MIME types. Yup. Our page went down (for a very short time) because of MIME types.

A quick review of MIME-types led me to this nugget from Mozilla on MIME-sniffing:
Image description

It turns out that a partial/invalid bundle of our app on Cloudflare had produced a malformed file. That file was returned as part of the page request and when the browser couldn't confirm that the MIME type in the header matched the contents, it freaked out and refused to show the page.

In the end, we just had to rebuild the bundles and all was well. But we never would have discovered this clue if someone had not thought to check the MIME-type response header. Seeing that and knowing that it should have been something different led us to the real issue.

Basics FTW!

Top comments (0)