Tuesday, 5 November 2013

mod_xsendfile and OS X Server.app

mod_xsendfile is a small Apache2 module that processes X-SENDFILE headers.

It makes it much quicker to download large files from a webserver and allows them to be streamed directly from disk without having to be first read in to memory.

This module is not included in OS X as standard but is included in OS X Server.app. You might want to use this module with websites you have written yourself or with web systems you have downloaded and installed. I recently wanted to install and test the free open-source MunkiServer project which uses this module, I however encountered an issue doing so which I am documenting here so anyone else using OS X Server.app and mod_xsendfile can understand and solve if they also encounter it.

I initially found that the Apache web-server in Server.app was crashing repeatedly when I tried loading the MunkiServer web application. I eventually tracked this down to when MunkiServer tried loading mod_xsendfile and I determined it was when MunkiServer tried using the command

XSendFilePath /path/to/files

This command was added in mod_xsendfile version 0.10 it turns out that the version of mod_xsendfile included in Server.app does not include this command because it is an older version and therefore only supports the previous command of XSendFileAllowAbove instead. This command was no help for MunkiServer. The solution is to download the current version, compile it in Terminal using the command

apxs –cia mod_xsendfile.c

which requires you to have XCode installed and then configure Apache to load it instead of the version included in Server.app.

It seems the majority of MunkiServer users either don’t run it on a Mac or don’t run it using Server.app and either option means they typically always download the latest version and compile it.

You can download the latest mod_xsendfile from https://tn123.org/mod_xsendfile/

No comments:

Post a Comment