Report this

What is the reason for this report?

How to configure MIME types on an Ubuntu droplet w/MEAN installed?

Posted on July 9, 2014

I am using a pre-created Ubuntu droplet with MEAN installed. I believe there is a problem in how this server maps text/javascript MIME type. It seems to only return text /html. Do these droplets use Apache by default? Where do I look for Apache conf file(s)? What am I missing here?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

The issue is two-fold: 1) I misunderstood that when using MEAN, express.js is creating a web server for me. So any special handling of content-types needs to be done within express.js configuration files and main js file. 2) I was encountering the original issue because in DigitalOcean, I am running under “production” NODE_ENV path, instead of “development”. As such, my lib/node config file was looking for files in different root paths. That resulted in my index.html looking for all script files in a path that was valid for development environment, but not in production. Therefore, my app was returning “index.html” as a failover whenever an unknown path was requested, resulting in chaos.

Lesson learned, best to test multiple environments as best as possible before deploying to actual production environment.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.