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

Posted July 9, 2014 2.5k 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?

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.

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.

Submit an Answer