Virtualbox Bug related to SendFile

I have been doing more web development with Vagrant and VirtualBox. It’s a nice way to keep my dev environment nearly the same as my production environments. Recently I was doing some front-end coding and was running into the most bizarre errors with my JavaScript.

[highlight]It pays to read the documentation. Had I read it more thoroughly, I would have known about this before debugging it and wasting time. Oops![/highlight]

Turns out there is bug with VirtualBox’s shared folder support and sendfile. This bug was preventing the VM from serving new versions of any file in the shared directory. Obviously this is not good for web development.

The solution is easy enough. You just have to disable sendfile in your web server.

In apache:

In nginx:

Update:

The Vagrant documentation does include some information it: https://docs.vagrantup.com/v2/synced-folders/virtualbox.html