Skip to content

Commit

Permalink
minor symfony#11618 Add note about extra configuration for mod_xsendf…
Browse files Browse the repository at this point in the history
…ile (PReimers)

This PR was merged into the 3.4 branch.

Discussion
----------

Add note about extra configuration for mod_xsendfile

I added a note about how (and why) to add the additional header for `BinaryFileResponse` to use the `mod_xsendfile` Apache module.

Fixes symfony#10794

Commits
-------

ce4c2d9 Add note about extra configuration for mod_xsendfile
  • Loading branch information
xabbuh committed Jun 14, 2019
2 parents c5865ca + ce4c2d9 commit ae93ff9
Showing 1 changed file with 20 additions and 0 deletions.
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

0 comments on commit ae93ff9

Please sign in to comment.