File Senders

A file sender in this library is a WSGI application that computes the HTTP headers to be sent to the front-end server. It’s only called once XSendfileApplication checked that the request is valid and the file exists.

Built-in File Senders

By default, XSendfileApplication will use the file sender that corresponds to the standard X-Sendfile implementation (the one used by Apache’s mod_xsendfile, for example).

This is the list of file senders offered by this library:

  • standard: For Web servers with a standard X-Sendfile implementation.
  • nginx (NginxSendfile).
  • serve: To get XSendfileApplication to serve the files, which can be useful during development if your development Web server doesn’t support X-Sendfile.

The file sender can be set when XSendfileApplication is initialized:

DOCUMENT_SENDING_APP = XSendfileApplication(

Custom File Senders

To create a custom file sender, create a WSGI application that would return the headers you want and set it on your XSendfileApplication instance.