Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions components/http_foundation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,26 @@ if it should::

BinaryFileResponse::trustXSendfileTypeHeader();

.. note::

The ``BinaryFileResponse`` will only handle ``X-Sendfile`` if the particular header is present.
For Apache, this is not the default case.

To add the header use the ``mod_headers`` Apache module and add the following to the Apache configuration.

.. code-block:: apache

<IfModule mod_xsendfile.c>
# This is already present somewhere...
XSendFile on
XSendFilePath ...some path...

# This needs to be added:
<IfModule mod_headers.c>
RequestHeader set X-Sendfile-Type X-Sendfile
</IfModule>
</IfModule>

With the ``BinaryFileResponse``, you can still set the ``Content-Type`` of the sent file,
or change its ``Content-Disposition``::

Expand Down