Skip to content

Commit ce4c2d9

Browse files
committed
Add note about extra configuration for mod_xsendfile
1 parent e2c3021 commit ce4c2d9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

components/http_foundation.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,26 @@ if it should::
523523

524524
BinaryFileResponse::trustXSendfileTypeHeader();
525525

526+
.. note::
527+
528+
The ``BinaryFileResponse`` will only handle ``X-Sendfile`` if the particular header is present.
529+
For Apache, this is not the default case.
530+
531+
To add the header use the ``mod_headers`` Apache module and add the following to the Apache configuration.
532+
533+
.. code-block:: apache
534+
535+
<IfModule mod_xsendfile.c>
536+
# This is already present somewhere...
537+
XSendFile on
538+
XSendFilePath ...some path...
539+
540+
# This needs to be added:
541+
<IfModule mod_headers.c>
542+
RequestHeader set X-Sendfile-Type X-Sendfile
543+
</IfModule>
544+
</IfModule>
545+
526546
With the ``BinaryFileResponse``, you can still set the ``Content-Type`` of the sent file,
527547
or change its ``Content-Disposition``::
528548

0 commit comments

Comments
 (0)