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

July 9, 2014 1k views

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?

1 Answer

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.

Have another answer? Share your knowledge.