I recently ran into a strange issue with my development site. The setup is pretty standard: a Virtualbox VM and an nginx reverse proxy to it from my host. While building a resource server (CSS and JS) that would automatically build minified files, I ran into an issue where the first few characters of a JS file would be from the old file and the rest from the new file.
I had a
try_files directive that would try to serve the files if they existed, otherwise reverse proxy to my node.js application that built and streamed them. The files were factored into two JS files: a common and page level file. As more requests to pages are triggered, the common file would change because there are more files to factor out common resources. Anyways, the first few bytes/characters of the common file would be messed up.
Not really sure what was going on, I found some indications that there could be issues with
sendfile in my Virtualbox. Lo and behold, adding
sendfile off; to my nginx config fixed the issue.