diff --git a/components/http_foundation.rst b/components/http_foundation.rst index c959f4e8a65..14d73c310a4 100644 --- a/components/http_foundation.rst +++ b/components/http_foundation.rst @@ -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 + + + # This is already present somewhere... + XSendFile on + XSendFilePath ...some path... + + # This needs to be added: + + RequestHeader set X-Sendfile-Type X-Sendfile + + + With the ``BinaryFileResponse``, you can still set the ``Content-Type`` of the sent file, or change its ``Content-Disposition``::