File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -523,6 +523,26 @@ if it should::
523
523
524
524
BinaryFileResponse::trustXSendfileTypeHeader();
525
525
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
+
526
546
With the ``BinaryFileResponse ``, you can still set the ``Content-Type `` of the sent file,
527
547
or change its ``Content-Disposition ``::
528
548
You can’t perform that action at this time.
0 commit comments