Last Updated: September 09, 2019
· elbcoast

Vagrant: Apache/nginx serving outdated static files? Turn off sendfile()!

Made some changes to static files (css for example), but Apache/nginx on your Vagrant VM still delivering the old version or even corrupted files? Then you should turn off sendfile() in your Apache/nginx configuration!

Simply spoken, sendfile() uses kernel calls to copy files directly from disc to tcp. If you are using remote filesystems (like nfs or the VirtualBox Guest Additions stuff), this method isn't reliable.

You can find more info about sendfile() in this techrepublic article.

To turn off sendfile() in Apache, you can use the EnableSendfile off directive, for nginx use sendfile off.

4 Responses
Add your response

Thanks a lot !

over 1 year ago ·

Wow thanks! I've been searching for this for hours but all I was finding was stuff about etags/mod_expires which I knew was not the issue.

over 1 year ago ·

I was playing wit ETags and headers with no luck. Got to dive into the SendFile subject in my spare time.

over 1 year ago ·

Thanks! You make my day!

over 1 year ago ·