Linux, Web Development

Vagrant – CSS and JS broken when using shared folder

I have this problem with my CSS files getting broken encoding every time I make modifications on it on the shared folder in my host, where the shared folder is directly served by the VM’s HTTPD server (Apache). A quick search reveals that this is an issue with Apache.


According to StackOverflow question, the issue is caused by Apache’s default configuration when dealing with mounted filesystems and serving them as static files.

The solution is to turn EnableSendfile off in your httpd.conf. Open httpd.conf and look for the option EnableSendfile. Set the value to off. Sometimes, it is commented out and the default value is on for some versions. Remove the comment then set it to off.

That’s it!

1 thought on “Vagrant – CSS and JS broken when using shared folder”

  1. Thanks. Thought I was going crazy, trying to get javascript working. All good. Now, if I could just get apache pages loading faster… maybe also related to the shared folder?

    Just now noticed you’re in the Philippines. Great place.

Leave a reply

Your email address will not be published. Required fields are marked *